• Resolved jbeswick

    (@jbeswick)


    When I create a page and set the Template to any of the portfolio types, is it possible to restrict the posts that are shown based upon category?

    The use case is that we have three pages where we want to use the “Portfolio” template but each one needs to show posts from different categories.

    Many thanks in advance for your help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I second this question – I would like to know too!

    <?php
    query_posts(‘cat=17&posts_per_page=3’);
    while (have_posts()) : the_post();
    the_title();
    the_content();
    endwhile;
    ?>

    you can use this for restrict ing the categories. just you need to pass your category id and limit the posts per page.

    thanks
    P5systems

    Thread Starter jbeswick

    (@jbeswick)

    Very useful, p5systems – thanks very much.

    p5systems, I’m sorry, I’m not quite understanding your answer because I’m still learning my way around WP.

    For example, I want three different Portfolio pages: Video, Photography, and Ebooks. Video portfolio is for category “videos,” Photography portfolio is for category “photos,” and Ebooks portfolio is for category “books.” Let’s say portfolio page for video is ID #123, for photography it is ID #456, and for ebooks it is ID #789.

    How would I modify your code example for the Video portfolio page? If I see how it’s done for a specific page and parameters, then the other two would be easy to figure out.

    Also, do I insert the code into the Custom CSS in Theme Options, or do I insert it elsewhere, perhaps a child theme?

    Pinboard is a great theme, and I’d love to be able to customize it just a little bit more. Thank you ??

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Celeste1212, if you need further support than that provided in this thread, please create your own thread.

    Okay, but it seemed like a logical continuation. I’ll post another thread later, thanks.

    [Closed]

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to show only one category of media posts per page’ is closed to new replies.