2012-04-16 65 views
1

我有一个magento商店。我想用wordpress在其上添加一个博客网站(www.example.com/blog)。为此,我使用Fishpig的Wordpress Integration 2.2.7。我想为我的博客网站提供一个不同的模板。关于magento的WordPress的帖子

所以,我为wordpress博客页面创建了一个单独的模板。在页面的顶部,我想添加最近的帖子滑块,即,我想显示一个帖子的特色图像与少数几行内容与阅读更多选项。其他信息,如作者,发布日期也将与内容一起存在。 我如何在博客页面模板上实现这个功能?

此外,我的博客网站菜单导航将不同于商店的菜单导航。

我该如何实现?有没有可能这样做这个插件或任何其他? 请给我最好的建议。

在此先感谢。

回答

2

为了让你可以使用

$post->getFeaturedImage(); 

$发布是Fishpig WordPress邮寄集合对象的功能后的图像。这里是得到一个帖子里CATEGORY_ID = 3的一个例子:

$col_posts = Mage::getResourceModel('wordpress/post_collection') 
    ->addIsPublishedFilter() 
    ->addCategoryIdFilter(3); 
$col_posts->getSelect()->limit(1); 
$post = $col_posts->getFirstItem(); 

您可以自定义选择使用的Magento EAV上面收集或查看可用的Fishpig/WordPress的/型号/ Archive.php方法。

如果您想放置最近的邮政区块,请查看http://fishpig.co.uk/wordpress-integration/docs/recent-posts-block.html

4

您需要检索图像资源,然后获取图像的URL

$_image = $_post->getFeaturedImage(); 

echo $_image->getAvailableImage(); 

看看Fishpig/Wordpress/Model/Image.php更多网址的方法:

public function getThumbnailImage() 
public function getMediumImage() 
public function getLargeImage() 
public function getFullSizeImage() 
public function getPostThumbnailImage() 
public function getAvailableImage() 
public function getImageByType($type = 'thumbnail')