私は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/
完全なスニペットは次のとおりです。
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;
};