error wordpress, adjusted sidebar.php to show latest 10 posts

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-04-28T14:56:20Z Indexed on 2010/04/28 15:23 UTC
Read the original article Hit count: 319

Filed under:
|
|

Hi,

I'm trying to edit my sidebar.php file in my current them WP is using to display the last # of posts (only the titles) as links.

I tried using the example of http://codex.wordpress.org/Integrating_WordPress_with_Your_Website but I always get the error on the line that states where the file wp-blog-header can be found.

the error when opening the index blog page where the sidebar should be shown:

// Get the last 3 posts. Warning: require(/blog/folder/wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /blog/folder/wp-content/themes/default/sidebar.php on line 7

So what is wrong? Is there a way to permanently embed a function in my html template page that retrieves the latest few posts everytime an article is displayed on the template page?

the code:

<?php require('/the/path/to/your/wp-blog-header.php'); ?> 
<?php $posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($posts as $post) : start_wp(); ?> 
<?php the_title(); ?> 
<?php the_excerpt(); ?> 
<?php endforeach; ?> 

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about html