![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
IP: 153.99.80.189
|
|||
|
|||
|
Zen-cart 有个WOZ的插件,作用就是调用Wordpress 的文章,将这个作为新闻系统来用。
其实,通过Wordpress自带的函数调用,完全可以达到同样的作用,下面介绍两种方法,一种是调用最新的文章;另一种是随机调用Blog文章。 首先,把WordPress安装到zen-cart一个子目录里,设置好固定连接等 一、调用最新文章 在合适的地方加入下面两行代码,一般会放在产品页面(/includes/templates/你使用的模板文件名/templates/tpl_product_info_display.php <?php require('./wordpress所在目录/wp-blog-header.php'); ?> 这行调用WordPress自带函数,目录地址要随着WordPress安装目录变化而变化.如果你的Zen-cart不是根目录,那么前面就要打两个.['../wordpress所在目录/wp-blog-header.php'] <?php get_archives('postbypost', 10); ?> 这里的10指调用的最新文章数量 二、随机调用Blog文章 随机调用4篇Blog文章 <?php require('./wordpress所在目录/wp-blog-header.php'); ?> <?php $rand_posts = get_posts('numberposts=4&orderby=rand'); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> |
| Currently Active Users Viewing This Thread: 2 (0 members and 2 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding a new Product Type in Zen Cart | Illinois City | ZenCart | 0 | 2016-08-16 07:31 AM |
| What are the Server requirements to run Zen Cart? | Mackinac Island | ZenCart | 0 | 2016-07-17 12:33 AM |
| How to Install an Zen Cart Template | topvip | ZenCart | 0 | 2009-08-23 05:35 PM |
| X-Cart Multiple Input Validation Holes Permit SQL Injection and Cross-Site Scripting | topvip | X-Cart | 0 | 2009-07-21 10:03 AM |
| x-cart Template Editing Guide for 4.1.x | topvip | X-Cart | 0 | 2009-04-15 11:42 PM |