How to display blog posts (Fishpig module) with featured images on magento homepage?

When we integrate fishpig with magento we can have one folder
“wordpress” in the template folder.(path:- app\design\frontend\base\default\wordpress).
in that we can create our custom folder like “xyz”.
in that we need to create one .phtml file called “xyz.phtml”.

the followings code returns the post name, post featured image etc…

<?php
 $posts = $this->getPosts() ;
if (count($posts) > 0): 
 foreach($posts as $post): ?>
<img src=" <?php echo $image_url = $post->getFeaturedImage()->getAvailableImage();?>" />
// also call here getAvailableImage(); for  Featured image  plz take <img> tag
<?php
echo  getPermalink(); // Post link
echo $post_date = $post->getPostDate(); // Post date
 echo $post_day = date('l', strtotime($post_date)); // Day of Post
echo $post_title = $post->getPostTitle(); // Post Title
endforeach;
 endif;
?>

Then call this template in home page slide section like,

<?php createBlock('wordpress/sidebar_widget_posts')->
setTemplate('wordpress/xyz/xyz.phtml');
$blog->setPostCount(6);
echo $blog->toHtml();
?>

8 thoughts on “How to display blog posts (Fishpig module) with featured images on magento homepage?

  1. I do consider all the ideas you’ve presented on your post. They’re really convincing and can certainly work. Still, the posts are very brief for novices. May just you please extend them a little from next time? Thanks for the post. eaebacdbcgeb

    Like

    • Thank you very much for your feedback.. We will try to explain the posts in detail from now onwards. Though if you have any doubt feel free to write you comment below…

      Like

  2. I have 1.8.0 magento version and 3.1.1.9 fishpig Version, but got this:
    Fatal error: Call to undefined function createBlock() in /…/template/catalog/category/view.phtml on line 97
    Can you help me, please!

    Like

  3. Hi, you’ve got an error in your code:

    Instead of:

    it should be

    getLayout()->createBlock(‘wordpress/sidebar_widget_posts’)->

    (Basically, you’ve missed off some of the code!)

    Like

Leave a comment