Support » Fixing WordPress » Code for displaying a complete blogpost category on a page

  • When I click on a page (might even be outside a WordPress blog site, but not necessary), I want to reach a page showing me posts within a specific category.

    What code is needed for this to work?

    Lee

Viewing 1 replies (of 1 total)
  • details depend on the theme you are working with;
    general:
    alternative a:
    make a category-specific.php (‘specific’ is the category slug of your specific category) and use the ‘page-links-to’ plugin to point your page name to this category archive.
    http://codex.wordpress.org/Category_Templates
    you probably need to add some code to make it show all posts.

    alternative b:
    make a page template ( http://codex.wordpress.org/Pages#Page_Templates )
    probably by copying category.php (or archive.php) and saving it under the file name for your page template; modify it with the requiremnts for a page template; then add a line with query before the begin of the loop; for instance:
    <?php $catid = get_cat_ID('specific'); $args = array('posts_per_page' => -1, 'category__in' => $catid ) ; query_posts($args); ?>
    then assign that template to your page.

Viewing 1 replies (of 1 total)
  • The topic ‘Code for displaying a complete blogpost category on a page’ is closed to new replies.