• Resolved cody81

    (@cody81)


    I am working on a blog, here lookz

    I want the last 10 headlines to be shown in a column in the upper left area, beside the maincontent window.

    I need to create a new column with css, and then using some code from the archive.php file i suppose…

    I also need to make a backup of it all.

Viewing 4 replies - 1 through 4 (of 4 total)
  • use this code snippet..

    <?php
    $cat = 2; // ID of the category you want to show...
    
    $recent = new WP_Query("cat=". $cat ."&showposts=10"); // showposts=10 means you want to show 10 latest headlines
    ?>
    <ul>   
    
     <?php while($recent->have_posts()) : $recent->the_post();?>
    
    <li>
        <a href="<?php the_permalink(); ?>"><?php the_title(); // title of the each post ?></a>
    </li>
        <?php endwhile; ?>
    </ul>
    <?php
    //done
    ?>

    is there a way to enable this for all categories?

    Try:

    <?php
    $recent = new WP_Query('showposts=10'); // showposts=10 means you want to show 10 latest headlines
    ?>
    <ul>
     <?php while($recent->have_posts()) : $recent->the_post();?>
    <li>
    <a href="<?php the_permalink(); ?>"><?php the_title(); // title of the each post ?></a>
    </li>
    <?php endwhile; ?>
    </ul>
    <?php
    //done
    ?>

    thats great, thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Latest headlines’ is closed to new replies.