Archived topic
Create a page with al the post of a category
13 replies · Started by Toni Rivas on June 15, 2015
Hello Tom,
I want to create a page (with header) that list all posts of one category. I've tried to create a new template with a sql sentence before the loop in page.php but it doesn't work.
In this case, the page header dissapear, and the posts of this category doesn't appear in mansonary style.
Can you help me?
Hi Toni,
How about using the built in WordPress category template?
For example, go to yourwebsite.com/category/your-category-slug
That's what I'm doing for our development category: http://generatepress.com/category/development
Hi Tom,
I know that, but in my issue, for each category exists some common information that I want to see always before the posts(an image, text, paragraphs, and more HTML tags).
So I need to add the posts to an existing page.
Thank you very much for your help.
Hmm, in order to display posts on a page, you'll have to use a plugin with a shortcode: https://wordpress.org/plugins/display-posts-shortcode/
Otherwise, you can use GP Hooks to display certain HTML and information above the category listings.
One other option if you only want text is to add a description to your categories in "Posts > Categories".
Ups! Sorry but ...
I only want a category page like the built in WordPress category template. The only difference is that I want to personalize the header of this page,but not only text (more than the description).
The shortcode doesn't shown post like the home page (mansonary).
So the solution is GP Hooks? but how can use it? I personalize each category page? Or is the same for all categories pages?
Thanks
You can use the is_category() WordPress conditional to display content (HTML, shortcodes, whatever) in GP Hooks.
More info here: http://generatepress.com/forums/topic/gp-hooks-2/#post-58676
Great!
But I don't know how can I give the same format to this HTML div (it includes an image, some text (with h2 or h3), tables, and maybe a slider).
I think I use the Inside Content Container Hook.
Thank you
I would use the "Before Content" hook :)
If you don't know the HTML, it may be worth building it out in a page, then grabbing the code the "Text" editor and putting it into the hook.
The only thing the WordPress editor doesn't do is wrap your paragraphs with <p></p> tags, so that part you'll need to do.
Sorry Tom, but if I use the "Before content" hook the HTML text is shown in each post. So, I don't known what it's happening!
Ah, you're right - you definitely want to use the inside content container hook.
Were you able to get the HTML added?
Hello, lovely solution with "display posts shortcode" plugin, but how to make it work with do_action('generate_sidebars') in posts?
in posts (single.php) generate_sidebars widget list only main menu (posts dont have directory structure), but I wish to keep same sidebar menu as in previous page.
What widget are you using to display the menu in your widgets? It shouldn't change between pages and posts.
Uff till now i am not getting satisfactory answer!! :(
Hi James,
What's your question?
