• I have a page template up and running. The only problem is that I am unable to get it to only display a certain category of posts AND include paged links. Right now the best I can get it is just display a large number of posts, but I would like to only display 10 per page just like on the main blog page. I know just enough about PHP not to break things… but I can’t figure this one out. How do I change this:

    <?php
    $wp_query = new WP_Query();
    $wp_query->query( array( ‘posts_per_page’ => get_option( ‘posts_per_page’ ), ‘paged’ => $paged ) );
    $more = 0;
    ?>

    To display only 5 posts per page only Category 3…. for example. I’ve tried a number of different things, but no luck yet. Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter jon1938

    (@jon1938)

    <?php
    $wp_query = new WP_Query();
    $wp_query->query(array(‘category__and’=>array(3), ‘showposts’=>5, ‘paged’=>$paged)); $more = 0; ?>

    This worked displays Category 3, 5 posts per page. The $more = 0; at the end ensures that the “read more” link shows. Hope this helps someone in the future.

Viewing 1 replies (of 1 total)

The topic ‘Making a custom page template post query’ is closed to new replies.