Hello all!
This is my first post here so kindly be gentle, I am not lazy: I have searched for this on google but didnt find the answer.
Basically i have my sites blog set up at ezee.se/articles-blog/ and what i want to do is get the headlines of the past x number of articles to show on my first page.
I have seen this done on other sites like: latest 5 articles from our blog
1. blah 1
2. blah blah
3. blah
etc
Any help would be appreciated and thanks in advance.
Use get_posts().
<ol>
<?php
$lastposts = get_posts('numberposts=5');
foreach($lastposts as $post) :
setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ol>
Hi!
Thanks for replying!
I tried it here:
http://www.ezee.se/articles-blog/test_wordpress_headlines.php
but its giving me this error:
Fatal error: Call to undefined function get_posts() in /home/ezeese/public_html/articles-blog/test_wordpress_headlines.php on line 2
What do i do?
Thanks!
You are supposed to put the code in one of your theme files (e.g. sidebar.php), not in a totally unrelated file.
Hi!
Thats exactly it... i want the headlines in ezee.se/index.php not in the blog itself... any way to do that?
Thanks!
I have been doing this for a while... I have 5 seperate WP installs, and on my main home page (which is outside all WP blogs) I show recent posts from all 5 of these installs.
The problem is that I just upgraded to WP 2.5 and it stopped working... when I get it working again, I'll post some info here for you.
Try this for now and see if it turns up what you need:
http://wordpress.org/search/Displaying+posts+on+an+external+page.?forums=1
There are a lot of ways to this. Magpie and SimplePie are both written in PHP and can handle this task very easily. SimplePie even has a quick tutorial on how to include multiple feeds.
Or you can just use the old school PHP + MySQL to do it.
Thanks guys, will have a look and come back if i still hit a wall
Got it! Anyone else in this problem can check out:
http://wordpress.org/support/topic/128858?replies=3
Cheers!