zencart调用wordpress博客文章的办法:
一、调用最新文章
在契合之处问鼎下面两行代码,一样平常会放在制造品页面(/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文章
随机调用5篇Blog文章
<?php require(‘./wordpress所在目次/wp-blog-header.php’); ?>
<?php
$rand_posts = get_posts(‘numberposts=5&orderby=rand’);
foreach( $rand_posts as $post ) >
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endforeach; ?>