【问题标题】:Magento Fishpig Wordpress module - Creating a custom post listMagento Fishpig Wordpress 模块 - 创建自定义帖子列表
【发布时间】:2012-06-14 16:58:01
【问题描述】:

这应该很简单,但由于某种原因并非如此。我只是希望能够加载我自己的模板文件并访问 $this->getPosts() 方法。

我试过了:

<block type="wordpress/post_list" name="blog_header" template="unleaded/fishpig/header.phtml"/>

然后在我的模板中:

<?php $_posts = $this->getPosts() ?>
<?php foreach ($_posts as $_post) : ?>
     <?php echo $_post->getAuthor() ?>
<?php endforeach ?>

这不起作用。查看主 List.php 块文件,该集合是基于“包装器”返回的,但我似乎找不到那是什么。

有没有其他人有在 Magento 的任何模板中获取帖子列表的代码示例?

【问题讨论】:

    标签: wordpress magento fishpig


    【解决方案1】:

    首先抓住街区很简单。还有其他方法,但这对我有用。

    <?php $_block = $this->getPostListBlock() ?>
    <?php $_posts = $_block->getPosts() ?>
    

    【讨论】:

      猜你喜欢
      • 2012-07-05
      • 2016-12-21
      • 2013-12-06
      • 2017-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-06
      • 2014-02-16
      相关资源
      最近更新 更多