Posted By

visualadvance on 01/04/10


Tagged

php page wordpress category


Versions (?)

Wordpress: Category Specific Pages


 / Published in: PHP
 

This is helpful if you want to create a "Page" that displays specific "Categories" in wordpress.

  1. Duplicate your themes "page.php"
  2. Rename it to something more specific "page_mycategory.php"
  3. Edit that file with the code below.
  4. In your Wordpress admin, when editing a page look under the "attributes" panel and select your new page from the "templates"
  1. // code for your custom page.php file. Put this near the top:
  2. <?php
  3. /*
  4. Template Name: MyCategory Page
  5. */
  6. ?>
  7.  
  8. // then to make it display specific categories put this code just above the area that says something like <?php if (have_posts().....
  9. <?php query_posts('cat=5'); ?>

Report this snippet  

You need to login to post a comment.