How To Change In Recent Post Widget In Wordpress

Discussion in 'PHP' started by freelanceinphp, Feb 12, 2013.

  1. #1
    Friends,
    I wanted to change in recent post to show only particular category_id posts.
    Where and what to change in which file
     
    Solved! View solution.
    freelanceinphp, Feb 12, 2013 IP
  2. ShinoRex

    ShinoRex Well-Known Member

    Messages:
    227
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    148
    #2
    Hi there? First of all let me know which WordPress theme you are using? Then I can help you.
    Actually it can do by using the below code

    <ul> <?php global $post; $myposts = get_posts('numberposts=5&offset=1&category=3'); foreach($myposts as $post) : setup_postdata($post); ?> <li><?php the_title(); ?> </li> <?php endforeach; ?> </ul>

    here 3 is the category ID that you need to display... Hope this will help you...

    Thanks
    Shino
     
    ShinoRex, Feb 12, 2013 IP
  3. #3
    Or else here is another simple method , you can use 'advanced-recent-posts-widget' from wordpress.. it is more simple.. Thanks Shino
     
    ShinoRex, Feb 12, 2013 IP
  4. freelanceinphp

    freelanceinphp Member

    Messages:
    134
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #4
    Thanks ShinoRex, I used advance-recent-posts-widget and got fixed now..
     
    freelanceinphp, Feb 12, 2013 IP