Archived topic
Content Template for Archive, Search Pages
5 replies · Started by Samuel on January 22, 2022
I know how to use the content template to control how the individual posts are displayed on an archive page, but I'd also like to create a template for the entire page. For example, I'd like to put all the search results in a container. Is there a way I can do this with an element?
Hi Samuel,
Any example sites we can have a look to help understand what you are trying to achieve better?
Unfortunately it's still on my local computer. The big thing I want to do is be able to wrap the search results around a GB Container block. So for example the html on the main content area of the page would be:
Headline Element
Open Container Element
Post 1
Post 2
Post 3
Close Container Element
I can use a content template to style Post 1, 2, 3 the way I want to. I'm wondering if there is a way to create a template for the entire page. In the example above that would include the Headline element and Container element that the search results appear in.
Hi there,
no thats not possible using a Content Template.
What is the purpose of this additional container ? As the Search results are already in a container if you just need to style it differently we can provide some CSS.
What I want to do is display the posts in a two column flex container with a specific gutter, etc. I can think through an alternate approach from what I was doing. One thing I ran into is that the navigation element. When I make the div that contains the list of posts a flex container the page navigation at the bottom wants to act like the last flex element since it is in the same div. What's the best way to solve that?
Simplest option is to use the Blog Columns option in the Customizer > Layout > Blog:
https://docs.generatepress.com/article/using-columns-in-the-blog/
If need be you can set columns for different templates:
https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns