[Resolved] Create a page with al the post of a category

Home Forums Support [Resolved] Create a page with al the post of a category

Home Forums Support Create a page with al the post of a category

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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?

    #114714
    Tom
    Lead Developer
    Lead Developer

    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

    #114820
    Toni 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.

    #114857
    Tom
    Lead Developer
    Lead Developer

    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”.

    #115024
    Toni 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?
    Thanks

    #115092
    Tom
    Lead Developer
    Lead Developer

    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

    #115111
    Toni 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 you

    #115169
    Tom
    Lead Developer
    Lead Developer

    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.

    #115255
    Toni 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!

    #115301
    Tom
    Lead Developer
    Lead Developer

    Ah, you’re right – you definitely want to use the inside content container hook.

    Were you able to get the HTML added?

    #139268
    richie

    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.

    #139415
    Tom
    Lead Developer
    Lead Developer

    What widget are you using to display the menu in your widgets? It shouldn’t change between pages and posts.

    #203293
    james

    Uff till now i am not getting satisfactory answer!! ๐Ÿ™

    #203352
    Tom
    Lead Developer
    Lead Developer

    Hi James,

    What’s your question?

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.