Tuesday, February 14, 2012

show one or more post in wordpress

show one or more WordPress post in header , index , or category page according to you


       <?php
       $args 
= array( 'numberposts' => 1'order'=> 'ASC''orderby' => 'id''category' => );
       
$postslist get_posts$args );
       foreach (
$postslist as $post) :  setup_postdata($post); ?>
      <?php the_content(); ?>
      <?php edit_post_link('Edit'); ?>
      <?php endforeach; ?>

numberposts = how many post , you want to show
order = ASC  or DESC
orderby = id , title , etc
category =  category id

1 comment:

  1. this post is very helpful for me , thanks to posting this information

    ReplyDelete

If you Satisfied , Please Leave a comment