私はすでにウェブ上で彼の問題に関するいくつかの情報を読みましたが、私は深刻な解決策はありませんでした。 リソース私が読んで:
http://codex.wordpress.org/The_Loop#Multiple_Loops_in_ActionWordpressの複数のループの動作 - ナビゲーションの複製
http://wordpress.org/support/topic/next_posts_link-not-displays-same-posts-not-next-posts-when-using-offset - 正確に同じ問題。今ここに
は、index.phpの中に私のコードです:私は、次の記事を押すと
<!--slider-->
<div id="featured">
<?php
// query the posts of your custom post types
query_posts('posts_per_page=5');
if (have_posts()) : while (have_posts()) : the_post(); ?>
<!--main body-->
<?php
// query the posts of your custom post types
query_posts('posts_per_page=5&offset=5');
if (have_posts()) : while (have_posts()) : the_post(); ?>
私はボディポストの同じ複製を取得します。
これの解決方法は何ですか?
EDIT: 私は新しいコードを書いている:
// featured
$slider = new WP_Query(array('posts_per_page' => 5));
if ($slider->have_posts()) : while ($slider->have_posts()) : $slider->the_post();
//main:
$p = get_query_var('paged');
if($p >0){
$main = new WP_Query(array('posts_per_page' => 5, 'paged'=>get_query_var('paged')));
}else{
$main = new WP_Query(array('posts_per_page' => 5, 'offset' => 5,'paged'=>get_query_var('paged')));
}
if ($main->have_posts()) : while ($main->have_posts()) : $main->the_post();
//ナビゲーション:
<div class="navigation" >
<div class="next-posts"><div class="nextBtn2"><?php previous_posts_link(); ?></div></div>
<div class="prev-posts"><?php next_posts_link(); ?></div>
</div>
に何がある – hakre