2

I would like to be able to display all the posts in a certain category on a page so that all posts are on that one page and there is no pagination.

If possible, I would also like to display a short preview of the posts - all posts will have a thumbnail and a short paragraph at the start.

I've tried various different plugins, but so far none of the one's that I have found do the job.

Does anybody know of a plugin or a way to do this? Alternatively, modifying the default category pages so there is no pagination is an option if all else fails...

2 Answers 2

5

The way i'd do it:

First - create a page in the wp admin. Then create a file like mypage.php. Save it in your theme and a the top of it, add this to tell wordpress that this is a custom page template:

<?php /* Template Name: Custompage */ get_header(); ?>

Note: it'll also already call your header.

Then insert a custom loop using get_posts() like this:

<?php global $post; // required
$args = array('category' => 9); // include category 9
$custom_posts = get_posts($args);
foreach($custom_posts as $post) : setup_postdata($post);

// put here what you want to appear for each post like:
//the title:
the_title();

// an excerpt:
the_excerpt();

//and so on...    

endforeach;
?>

Then last, get back to the admin and in your page's options you should have a drop down menu in the "page attributes" box. Select the "Custompage" template or whatever name you gave it.

1
  • Sorry for the slow reply, and thanks for the code. However for some reason it didn't work for me first off and anyhow, it seemed a bit tedious having to create pages and select the template I have, so I have found a solution that works with the existing category pages (see my answer)... Thanks again though
    – Andy
    Mar 17, 2012 at 21:25
0

I found a plugin-solution eventually to the my second option. I now use Posts per cat and set it to some silly number so that all of the posts in the category display on one page; it turns out that's all I needed!

Thanks and Regards

Not the answer you're looking for? Browse other questions tagged or ask your own question.