Wordpress: Page with content from only a particular category


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php query_posts('cat=3&showposts=10'); ?>
  2. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  3. <div class="blog-entry">
  4. <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
  5. <div class="post_content">
  6. <?php the_content(__('Read more…')); ?>
  7. </div> <!– close post content –>
  8. <div class="post-end-content">
  9. Posted in <?php the_category(', ') ?> | <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> <?php edit_post_link('Edit','',''); ?>
  10. </div>
  11. </div>
  12. <?php endwhile; else: ?>
  13. Sorry, but you are looking for something that isn‘t here.
  14. <?php endif; ?>
  15. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.