![]() |
zencart调用wordpress
调用最新4篇Blog文章
<?php require('./wordpress所在目录/wp-blog-header.php'); ?> <?php $rand_posts = get_posts('numberposts=4&orderby=post_date'); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br /><?php echo substr($post->post_content,0,200).'...';?></li> <?php endforeach; ?> |
Code:
<!-- BOF Load Wordpress -->numberposts=3&orderby=post_date 其中3代表要调用文章数目 内容太长了我不想调用了 以上部分代码放在 ../common/tpl_mail_page.php里 <div id="navColumnTwoWrapper" style="width: <?php echo BOX_WIDTH_RIGHT; ?>"> 下面 那显示的结果就是右侧栏最上面 |
产品页面调用WordPress最新文章 已解决
把WordPress安装到zen-cart一个子目录里吧,设置好固定连接等 这个文件/includes/templates/template_default/templates/tpl_product_info_display.php在合适的地方加入下面两行代码 <?php require('../wordpress所在目录/wp-blog-header.php'); ?> 这行调用WordPress自带函数,目录地址要随着WordPress安装目录变化而变化 <?php get_archives('postbypost', 10); ?> 这里的10指调用的最新文章数量 |
| All times are GMT +8. The time now is 04:10 AM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.