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

Advertisements

One thought on “show one or more post in wordpress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s