magento整合wordpress(二)
来源:互联网 发布:淘宝卖家流量怎么计算 编辑:程序博客网 时间:2024/06/14 08:36
让最新添加的blog在首页显示(需要插件,记得先看上篇再看这篇文章)
1,在/app/design/front-end/base/default/template/WordPress/sidebar/widget下新建 frontposts.phtml。
2,复制一下代码到 frontposts.phtml。
<?php/*** @category Fishpig* @package Fishpig_Wordpress* @license http://fishpig.co.uk/license.txt* @author Ben Tideswell <help@fishpig.co.uk>*/?><?php $posts = $this->getPosts() ?><?php if (count($posts) > 0): ?><div><ul id="<?php echo $this->getListId() ?>"><?php foreach($posts as $post): ?><?php $post->setExcerptSize($this->getExcerptLength()) ?><li><?php if ($this->canDisplayExcerpt()): ?><a href="<?php echo $post->getPermalink() ?>" title="<?php echo $this->htmlEscape($post->getPostTitle()) ?>"><!--控制显示文章内容 <p><?php $content = $post->getPostExcerpt(); $content = strip_tags($content); echo substr($content, 0, 250); ?> ...</p> --><!--控制显示文章标题--> <p style="padding-left:5px; padding-top:3px;"><?php $title= $this->htmlEscape($post->getPostTitle()); $title = strip_tags($title); echo substr($title, 0, 50); ?></p></a><?php endif; ?></li><?php endforeach; ?></ul><script type="text/javascript">decorateList('<?php echo $this->getListId() ?>')</script><?php if ($this->canShowPager()): ?><?php echo $this->getPagerHtml() ?><?php endif; ?></div><?php endif; ?>
3,在想显示新闻的地方添加一下内容即可。(后台》CMS》page)
{{block type="wordpress/sidebar_widget_posts" name="wordpress.widget.recent_posts" post_count="5" title="Latest Blogs" excerpt="on" excerpt_length="250" date="off" comment_num="off" template="wordpress/sidebar/widget/frontposts.phtml"}}
- magento整合wordpress(二)
- magento整合wordpress(一)
- wordpress和magento整合
- 整合Wordpress到Magento的插件 - Lazzymonks Wordpress Integration
- Magento和Joomla 1.5,PHPBB 3,Wordpress 2.71的整合
- Magento 整合Ucenter(discuz)
- magento安装wordpress
- Centos6安装WordPress(二)WordPress安装
- 谷歌Analytics(分析)与Magento整合
- Magento 学习记录(二)
- Centos7安装WordPress(二)数据库配置、安装WordPress
- 整合wordpress的插件!!
- 在Magento中显示wordpress的文章
- Joomla和Magento的整合
- magento整合js css资源
- mongodb和magento的整合!
- 【Wordpress】分享500多款国外WordPress经典主题(整合)
- wordpress主题常用函数(二)
- JavaScript的InfoVis工具
- IIS和tomcat整合
- 【opencv&VS2008】关于cvAbs的那些事
- Exchange Server 2010/2013架构改变
- linux输入子系统(2)
- magento整合wordpress(二)
- Exchange Server 2010/2013功能差异
- Delphi 共享内存的应用
- 贪心算法--哈夫曼编码问题
- UVALive 3181 Fixing the Great Wall
- struts漏洞修复(升级到2.3.15)
- emac配置IDE
- jquery.cookie
- 如何从数据库调出数据显示到页面 PHP+Mysql+Html(简单实例)