如何使用 fishpig wordpress 集成扩展在 Magento 主页上显示单个 post 详细信息?

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

我在我的 Magento 网站上安装了 fishpig WordPress 集成,我想使用静态块(带有 post ID)在我的 Magento 主页上显示单个 post 详细信息。 所以请帮忙。

在您的模板中创建自定义 .phtml 文件并调用它

<?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>

之后,您就可以在cms首页调用您的.phtml文件了。之后使用此命令在您的主页上调用静态块:

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