這可能很簡單,但我無法弄清楚。我已經搜索了幾個小時,但沒有看到我的情況。我需要分頁與my_querywp_query中的分頁
<?php
$count = 0;
$id_suffix = 1;
$items_per_row = 4;
$quality = 90;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query = new WP_Query(array('posts_per_page' => '4', 'post_type' => 'portfolio'));
$grid_class = 'grid_3';
$desired_width = 220;
$desired_height = 190;
$terms = get_terms('portfolio_categories');
$count_terms = count($terms);
?>
//some php code
<?php while ($wp_query -> have_posts()) : $wp_query -> the_post(); //query the "portfolio" custom post type for portfolio items ?>
//some more php code
<?php endwhile;?>
<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'thematic')) ?></div>
<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'thematic')) ?></div>
</ul>
我得到了分頁顯示,但另一頁上點擊時,它顯示了相同的投資組合項目工作。任何幫助,將不勝感激。
我得到了分頁使用WP-pagenavi但同樣的問題,與不改變的項目展示。
你打我吧。我會建議使用偏移參數,但你的方式更好。另外,是的,將實例名稱從$ wp_query更改爲其他內容至關重要。 – maiorano84
謝謝你的幫助,但我有同樣的問題(分頁不改變投資組合項目)。 –
btw我將'$ wp_query'改爲'$ my_query',現在分頁完全消失了。 –