Post Not Found Content For Elementor
As I was building a site for a client I found I wanted to show some custom content when there were no posts found for a particular post query. Elementor doesn’t do this out of the box and I found an open issue on elementor’s github repo for this issue. There was some good ideas on how to handle the issue, but I wanted to take it to the next level and incorporate choices into the elementor editor.
Choices are:
Select Saved Section

Simple Text Editor

I didn’t feel that a simple change like this required it own plugin, and so I suggest simply adding it to your child theme which is easy to do. If you don’t have a child theme yet, check out my post on how to set one up here.
In your functions.php page add the following line:
functions.php
In that same folder make a new file and add the following class.
post_not_found_content.php
At that point you should be able to refresh the page, and view the additional settings available in the elementor editor.
Disclaimer: I do not advise editing the code of your production website, please test your code on a local or staging site to make sure everything works correctly. If you have questions, feel free to ask your questions in the comment area below and I will do my best to answer them.
Add comment
6comments