0

我想通过fishpig wordpress extension 4.0在magento中收集帖子。在以前的版本中,它通过

$mypostcollections = Mage::helper('wordpress/post_collection')
                 ->addIsPublishedFilter()
                 ->addCustomFieldFilter("is_featured_post", "1")
                 ->load();

但在更新扩展至 4.0 版后,它无法正常工作。请建议我一些解决方案。

4

1 回答 1

0

版本 4.0 升级中有很多更改,但您发布的代码从未起作用(您不能以这种方式通过帮助程序创建集合)。下面的代码将在 4.0 版本中运行。

<?php
 // Load a collection
 $collection = Mage::getResourceModel('wordpress/post_collection');

// Filter by post type 'post'. Not required for version 3.*
$collection->addPostTypeFilter('post');

// Change to addIsPublishedFilter if using version 3.*
$collection->addIsViewableFilter();

// Apply a meta value (custom field) filter
$collection->addMetaFieldToFilter('is_featured_post', 1);

// Load the collection
$collection->load();
于 2015-07-24T15:24:59.397 回答