- This topic has 13 replies, 3 voices, and was last updated 8 years, 7 months ago by
Tom.
-
AuthorPosts
-
June 15, 2015 at 1:44 am #114656
Toni Rivas
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?June 15, 2015 at 9:01 am #114714Tom
Lead DeveloperLead DeveloperHi 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
June 15, 2015 at 3:07 pm #114820Toni Rivas
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.
June 16, 2015 at 12:04 am #114857Tom
Lead DeveloperLead DeveloperHmm, 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”.
June 16, 2015 at 3:10 pm #115024Toni Rivas
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?
ThanksJune 17, 2015 at 12:13 am #115092Tom
Lead DeveloperLead DeveloperYou 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
June 17, 2015 at 2:27 am #115111Toni Rivas
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 youJune 17, 2015 at 9:06 am #115169Tom
Lead DeveloperLead DeveloperI 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.June 17, 2015 at 3:48 pm #115255Toni Rivas
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!
June 18, 2015 at 12:01 am #115301Tom
Lead DeveloperLead DeveloperAh, you’re right – you definitely want to use the inside content container hook.
Were you able to get the HTML added?
September 24, 2015 at 1:00 am #139268richie
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.
September 24, 2015 at 10:29 am #139415Tom
Lead DeveloperLead DeveloperWhat widget are you using to display the menu in your widgets? It shouldn’t change between pages and posts.
June 20, 2016 at 6:21 am #203293james
Uff till now i am not getting satisfactory answer!! ๐
June 20, 2016 at 10:07 am #203352Tom
Lead DeveloperLead DeveloperHi James,
What’s your question?
-
AuthorPosts
- You must be logged in to reply to this topic.