我有這個循環運行在我的WordPress的索引(index.php)頁面,它顯示我的帖子沒有問題。爲什麼我的Wordpress查詢不適用於非索引頁面?
但是,如果我嘗試在另一頁上使用此代碼,找不到帖子。
任何人都可以解釋爲什麼嗎?
Ta!
<?php
$args = array(
'post_type' => 'post',
);
$query = new WP_Query($args);
if ($query->have_posts()) :
// Start the Loop.
while (have_posts()) : the_post();
get_template_part('content', get_post_format());
endwhile;
// Previous/next post navigation.
twentyfourteen_paging_nav();
else :
get_template_part('content', 'none');
endif;
?>
這個模板的名字是什麼? –