Wordpress display content of a category on a page


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



Copy this code and paste it in your HTML
  1. <?php if (is_page('pagename')) { query_posts('cat=yx') } ?>
  2.  
  3. <!--or use query_posts like this:(full loop)-->
  4.  
  5. <?php
  6. $displayposts = new WP_Query();
  7. $displayposts->query('cat=5');
  8. while ($displayposts->have_posts()) : $displayposts->the_post();
  9. ?>
  10. <?php the_content('read more...'); ?>
  11. <?php edit_post_link('edit', '', ''); ?>
  12.  
  13.  
  14. <?php endwhile; ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.