I▓ve been working on this mod to show the latest 5 posts from the blog in the homepage. Currently we have that functionality with XNews; however, we▓d like to show the blog posts instead.
Steps taken:
1.) Created blog.php to call the latest 5 posts from
www.site.com/blog:
PHP Code:
<?php
$how_many=5; // Number of posts you want to show
require_once('blog/wp-config.php'); // Set up path to wp-config.php file ?>
<?php
$postlist = get_posts('numberposts=5');
foreach ($postlist as $post) :
// numberposts=X is the number of posts you want to show?>
<p><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></p>
<?php endforeach; ?>
When
www.site.com/blog.php is entered in the address bar, it shows the 5 latest posts.
2) Then, I created blogspots.tpl in skin1/customer/ to call blog.php located in the root directory:
HTML Code:
<div id="homenews">
{include_php file="blog.php"}
</div>
3) Finally, blogspots.tpl was called from home.tpl with:
HTML Code:
{include file="customer/blogposts.tpl}
Now I am getting this error message:
Fatal error: Call to a member function on a non-object in
/home/site/public_html/blog/wp-includes/functions.php on line
895
Will appreciate if someone with coding experience can shed some light
Thanks,
Augusto