利用fishpig_wordpress_integration插件整合WordPress到Magento
magento目录下新建子目录blog,上传wordpress文件到该目录.
新建数据库magento_blog,也可以省略这一步,直接装在原数据库上,用前缀区分表.
运行http://yourmagento.com/blog安装wordpress.
安装fishpig_wordpress_integration插件,地址为http://www.magentocommerce.com/magento-
connect/fishpig/extension/3958/fishpig_wordpress_integration
后台进入/WordPress/Setting/Database Integration配置相关信息
Database
设置wordpress数据库位置,是与magento同一数据库还是单独数据库.
Integration
设置整合方式
Semi-Integration
Semi-Integration在magento应用程序中提供有限量的wordpress信息,且不自动显示.适合只想在magento中显示少量wordpress信息,让maegnto
跟wordpress保持各自的模板主题.
Full-Integration
Full-Integration允许wordpress的所以前台显示由magento负责,换言之wordpress使用magento的模板主题包.适合不想为wordpress单独制作模
板的用户.
如果选择Full-Integration,需要设置Blog Route,假设设置为wp,需要进入wordpress后台Settings->General设置Site address为
http://yourmagento1/index.php/wp
显示最新文章
<reference name="left">
<block type="wordpress/post_list_recent" name="wp.recent-posts" template="wordpress/post/recent.phtml">
<action method="setTitle"><title>Recent Posts</title></action>
<action method="setPostCount"><post_count>3</post_count></action>
</block>
</reference>
{{block type="wordpress/post_list_recent" template="wordpress/post/recent.phtml" title="Recent Posts" post_count="3"}}
显示指定目录
<reference name="left">
<block type="wordpress/post_list_recent" name="wp.recent-posts" template="wordpress/post/recent.phtml">
<action method="setTitle"><title>Recent Posts</title></action>
<action method="setPostCount"><post_count>3</post_count></action>
<action method="setCategoryId"><category_id>1</category_id></action>
</block>
</reference>
{{block type="wordpress/post_list_recent" template="wordpress/post/recent.phtml" title="Recent Posts" post_count="3"
category_id="1"}}
显示指定作者
<reference name="left">
<block type="wordpress/post_list_recent" name="wp.recent-posts" template="wordpress/post/recent.phtml">
<action method="setTitle"><title>Recent Posts</title></action>
<action method="setPostCount"><post_count>3</post_count></action>
<action method="setAuthorId"><author_id>1</author_id></action>
</block>
</reference>
{{block type="wordpress/post_list_recent" template="wordpress/post/recent.phtml" title="Recent Posts" post_count="3"
author_id="1"}}