【发布时间】:2013-03-21 07:28:02
【问题描述】:
我正在 Wordpress 中构建,并且有一些使用 jQuery.load 加载的内容。
$item = '<h2>'. the_title() .'</h2><div>'. the_content() .'</div>';
//$item = include 'myrequire.php'; This doesn't seem to work.
我想知道如何让 php 变量 $item 加载一个 php 文件 - 这样我就可以保持 functions.php 整洁,并且可以像这样编写文件:
<h2><?php the_title(); ?><h2>
...这有意义吗?
谢谢!
我遵循了这个教程: http://tomsbigbox.com/wordpress-load-more-posts-on-page-scroll/
这是完整的 sn-p:
function getArchives($count,$offset){
query_posts('posts_per_page='.$count.'&offset='.$offset);
$posts = array();
if(have_posts()) : while(have_posts()) : the_post();
$item = '<h2>'. the_title() .'</h2><div>'. the_content() .'</div>';
//$item = include 'myrequire.php';
array_push($posts,$item); endwhile; endif;
return $posts;
};
【问题讨论】:
标签: php wordpress function variables require