Show posts of category in a page

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

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.

Leave a Comment