magento-1.9fishpig

How to display single post details on Magento home page using fishpig wordpress integration extension?


I have install fishpig WordPress integration in my Magento website, I want to display single post details on my Magento's Homepage using static block ( with post ID ). so please help.


Solution

  • Create a custom .phtml file in your template and call this

    <?php
    $data=Mage::getModel('wordpress/post')->getCollection()->setOrderByPostDate()->addIsPublishedFilter()->addPostTypeFilter(array('post'))->setPageSize(1);
    ?>
    <div id="learn">
    <ul class="xyzs" id="carousel1">
    <?php $i = 0; foreach ($data as $post){
    {
    ?>
    <li class="item">
    <?php if ($featuredImage = $post->getFeaturedImage()){ ?>
    <div class="custom-image"><img alt="" src="<?php echo $featuredImage->getAvailableImage(); ?>"/></div>
    <?php } ?>
    <div class="learn_pragrap">
    <span class="custom-date"><?php echo $post->getPostDate(); ?></span>
    <h2><?php echo $post->getPostTitle(); ?></h2>
    <p> <?php echo substr($post->getPostExcerpt(),0,149); ?> </p>
    <div class="buttons-set">
    <a class="button posts" title="Learn More" href="<?php echo $post->getPermalink() ?>"><span><span>View Full Story</span></a>
    </div>
    </div>
    </li>
    <?php //} $i++;
    
    } ?>
      </ul>
    </div>
    

    After this, you can call your .phtml file in cms home page. After that call static block on your home page using this command:

    {{block type="core/template" template="custom/custom.phtml"}}