Site logo

Archived topic

Would love to profoundly customize my search results page.

9 replies · Started by Alicia on March 11, 2022

Viewing posts 1–10 of 10

Hi there,

the Block Element - Content Template supports Custom Fields, and if need be you can include a HTML block within it.
But looking at the example - what exactly is it your missing ?

The image I'm using isn't the featured image. It's the image uploaded for the comic via custom field. I've learned from the error of my ways: USE featured image already built into WordPress. But, it's too late, there are over 700 comics. It's easier to add the custom field.

I'm still confused. The content I'm trying to show is a custom post type called comic. I'm using ACF for the image upload. I can't see a way to choose a custom post type with the two options above.

OK - so do you currently have your Search Results displaying the CPT ?

Hi David!

I went old school and creating a custom search template file in the theme. From there, I was able to do exactly what I needed. If there was another way around this, would love to know.

This is what I love so much about GeneratePress! I'm able to do some really geeky template stuff or hook things in. Thanks for such an amazing theme!

Glad to hear that - and it sounds like the most appropriate solution for your need.

The Block Element - Content Template would not define the custom search template or the query args for specifying the post type.
It simply replaces the Template Part which GP would have requested using its generate_do_template_part function as seen here in our archive templates including search.php:

https://github.com/tomusborne/generatepress/blob/a3ce1712ab1cc705fed577fad8fa9ea8c04d5d20/search.php#L37

When you set a Block Element - Content Templates Display Rules, it will unhook the themes template part and hook itself in.

Yes! I used the block element to replace the content on the 404 page. Excellent!!

Awesome - glad to hear that :)

This archived topic is closed to new replies.