• Hello:

    I am new to WordPress and trying to integrate it into my existing website.

    I would like to display the headlines/titles for the last 5-6 posts on the front of my website with a link to each one’s page.

    Could someone provide a quick and easy way that I could grab those post titles and embed them on other pages of the web?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • I use the following piece of code on my website home page footer which you can see here.

    <ul>
    	<? query_posts('showposts=10'); 	// latest blog story?>
          <?php while (have_posts()) : the_post(); ?>
          <li>&raquo; <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
          <?php endwhile; ?>
    </ul>

    This shows the latest 10 post, just change the number showpost=10 to whatever you want.

    Hope this works for you.

    Thread Starter panther_26

    (@panther_26)

    Thanks Crondeau, however, the page that I am embedding these in is a standard HTML webpage and not part of WordPress.

    If you are trying to do this on an html page that is in html format and outside of your wordpress theme, then it won’t work. You will need to change it to php and write a php script.

    lenwbrown

    (@lenwbrown)

    Here is another option, and for me it works flawlessly on WordPress 2.9.2:

    (It displays the last 5 posts in a list as linked post titles)

    <ul>
     <?php
     global $post;
     $myposts = get_posts('numberposts=5');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show last 5-6 post titles on different page?’ is closed to new replies.