Wordpress (Show Latest Post on main page from a specific category)

Discussion in 'WordPress' started by LbR, Mar 14, 2009.

Thread Status:
Not open for further replies.
  1. #1
    I own a football blog and I want the latest posts to come on main page of a specific category

    I want football news to come one main page. And Highlights on the other page or not o display up. on main page any solution
     
    LbR, Mar 14, 2009 IP
  2. bilzone

    bilzone Peon

    Messages:
    579
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this code:

    <ul>
    <?php $recent = new WP_Query("cat=3&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    </ul>

    Where you have "cat=3" put what category you want to display and where you have "showposts=3" put the number of article you want to display.

    Hope that code will help you.
     
    bilzone, Mar 14, 2009 IP
    iskandar likes this.
  3. LbR

    LbR Banned

    Messages:
    970
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #3
    and where i place the code?
     
    LbR, Mar 14, 2009 IP
  4. bilzone

    bilzone Peon

    Messages:
    579
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Where you want to show your latest post. In sidebar.php or index.php. Depends...
     
    bilzone, Mar 15, 2009 IP
  5. wallpaperseller

    wallpaperseller Banned

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hope this code works for me too.. i have been trying the same but with some mods ..
    no changes in coding yet..
    will try and report here
     
    wallpaperseller, Mar 15, 2009 IP
Thread Status:
Not open for further replies.