Archived topic
Custom No Results Page
12 replies · Started by Zad on November 9, 2018
So I recently made a custom 404 page, but I also want to do the same with no-results page, I know there's a .php file on the parent theme, but I'm trying to figure out if there's any filter, function or PHP code thatll allow me to customize the message and insert my own image.
Hi there,
There currently aren't any filters for that template - I've marked it down as a to-do.
Let me know if you have any other questions :)
Hi Tom, thanks for keeping me in the loop. Hope that feature comes out soon! In the mean time, will taking the no-results.php document from the parent theme, duplicating it, and placing in the child theme folder in the PHP and making edits to it work for creating a custom version?
ANd if so, is there a particular area in the document where I can include some html to include an image?
That's exactly how you'd do it.
It depends on where you want the image.
For example, if you want it above the content, you could place it here: https://github.com/tomusborne/generatepress/blob/2.1.4/no-results.php#L42
Looks like it worked! However, I'm trying to center the image and the search bar using some CSS. This doesn't seem to work,
/* Center Custom 200 Image */
.Custom200, .error200 .search-form {
text-align: center;
}
/* Reduce Padding of Custom 200 Image */
.error200 .entry-content {
margin-top: 0.25em;
}
Give this a shot:
.no-results img {
display: block;
margin: 0 auto;
}
.no-results {
text-align: center;
}
Thanks much it worked!!
You're welcome :)
Hi, Tom!
Any news on the filters for the No results page?
https://alex.bandiwork.dev/?s=reteszat
I'm looking for a way to change the title and text, and found this old thread.
Thank you!
Hi there,
unfortunately no Filters are available in the no-results.php.
You would need to make a copy of the template:
https://github.com/tomusborne/generatepress/blob/master/no-results.php
And add this to your Child Theme and then modify the template to suit.
Hi, David!
It's no problem, I actually prefer this solution :)
Thank you so much for your help!
Alexandra
You're welcome