On wordpess how can i show recent posts on sidebar

Discussion in 'HTML & Website Design' started by McCoy, Jan 21, 2016.

  1. #1
    I have sticky posts on my site and this code doesn't work properly because of them. How can i show only recent posts on sidebar with codes.

    <ul><?php $posts=get_posts("numberposts=10&orderby=post_date&order=DESC"); foreach($posts as $post) : ?><li><a href=""><?php the_title(); ?></a></li><?php endforeach; ?></ul>
     
    McCoy, Jan 21, 2016 IP
  2. karen9999

    karen9999 Active Member

    Messages:
    278
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    78
    #2
    There are two ways for displaying recent post on sidebar 1.By using Coding
    2.Using Widgets like add Recent Posts widget to a sidebar.
    try with this code :[display-posts posts_per_page="5"image_size="thumbnail"include_excerpt="true"]
     
    karen9999, Jan 21, 2016 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,280
    Likes Received:
    1,696
    Best Answers:
    31
    Trophy Points:
    475
    #3
    qwikad.com, Jan 22, 2016 IP
  4. asheikha

    asheikha Member

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #4
    Simply go to widgets and use "Recent Posts" widget.
     
    asheikha, Feb 10, 2016 IP
  5. zinist

    zinist Banned

    Messages:
    91
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    43
    #5
    Simply and easy Widgets and use Recent Post..........
     
    zinist, Mar 7, 2016 IP