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

Comments

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

    ReplyDelete

Post a Comment

If you Satisfied , Please Leave a comment

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress