Hey! Does anyone know how I can display the latest 5 wordpress post title into the main website? Currently wordpress is installed in a folder on the same server I want to display the posts links on. How can I do that? Thanks
You will want to use a variation of "The Loop" that only prints out title. http://codex.wordpress.org/The_Loop To filter "The Loop" and only show your 5 latest posts, you will probably use the query_posts() method right before your loop. <?php query_posts($query_string . '&posts_per_page=5'); ?> PHP:
Save the following code as latest.php in your wordpress folder <?php $numberOfPosts = 5; if (empty($wp)) { require_once('wp-config.php'); wp('feed=rss'); } if ($posts) { $i = 1; foreach ($posts as $post) { start_wp(); ?> <a href="<?php permalink_single_rss() ?>" /><?php the_title_rss() ?></a><br> <?php if (++$i > $numberOfPosts) { break; } } } ?> PHP: Then you can include it in your main index file thusly <?php include "wordpress/latest.php"; ?> PHP: