You have a blog at domain.com/blog and would like for the latest blog posts to appear on domain.com. To be able to perform this action, follow the instructions below:
1) Copy the below script to where you wish the latest post to appear. Remember to amend add path to.
2) Amend numberposts=5 to the number of posts you require to appear on the homepage.
3) The below code will display the post title, linked back to your post. It will also display a short 55 word summary.
<?php
require(‘/add/path/to/wp-blog-header.php’);
?>
<?php
$posts = get_posts(‘numberposts=5&order=ASC&orderby=post_title’);
foreach ($posts as $post) : start_wp(); ?>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to<?php the_title(); ?>”><?php the_title(); ?></a>
<?php the_excerpt(); ?>
<?php
endforeach;
?>
What if you want to increase the default 55 worded summary?
1) Open formatting.php located within the folder wp-includes
2) Locate the code $excerpt_length = 55;
3) Amend the number as required
You may want to check out the script called CARP from geckotribes – its an RSS parser. Using that script, you can display feeds from several different sites in a variety of configurations.
CARP is the free version and only displays RSS2 feeds. If you need to display ATOM or RSS1 feeds, check out GROUPER – its a commercial grade feed parser.
With either of those scripts, you can display feeds from sites like CNN, Yahoo News, BBC, Foxnews. That way your site will stay updated with a variety of information.
Thanks for sharing gamer 🙂
Thanks for sharing
Was having some trouble with finding something like this until I came across this site. Thanks once again.
I don’t have a clue about coding but this was simple to follow
Hi there,thanks for the post I was looking to write a similar article myself to help my own readers, it’ll be easier to add a link to your post. Thanks again
Thanks! Just what I was looking for 🙂
Applied this to one of my sites, worked perfectly.
Well written.
What do I amend the ‘add path to’ with?
Thanks
Hi, its the path to where the file ‘wp-blog-header.php’ is located on your web server.