• My blog has Posts and Pages. I would like to be able to change about the template of the pages and have them aggregate all the posts in certain categories.

    i.e. people hit the ‘food’ link and the page has a food themed layout and only displays posts in the food category.

Viewing 1 replies (of 1 total)
  • The easiest way to do this is to take your theme’s category.php page and copy it to a new one called category-x.php where “x” is the ID of the category. WordPress will use this file instead of the standard category.php for any posts in that particular category. If your theme does not have a category.php then it likely has an archive.php, which will work – but be sure to copy it to category-x.php

    Then just customize your new page as you like – you can even call a different sidebar or header or footer file by changing those lines as in this example:

    <?php get_header(); ?>

    becomes <?php include (TEMPLATEPATH . "/header-foods.php"); ?>

    <php get_sidebar(); ?>

    becomes <?php include (TEMPLATEPATH . "/sidebar-foods.php"); ?>

    And so forth – of course you need to copy those files to new ones as well (header.php to header-foods.php, and sidebar.php to sidebar-foods.php), and then customize them with the correct stylesheet that you’ll hardcode into the new header file……

    Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘How can I display posts in pages?’ is closed to new replies.