出于某种原因,分页在这里不起作用,我无法弄清楚原因。
<?php
if ( get_query_var('paged') )
$paged = get_query_var('paged');
elseif ( get_query_var('page') )
$paged = get_query_var('page');
else
$paged = 1;
$post_type = 'portfolio';
$tax = 'type';
$tax_terms = get_terms($tax);
?>
<?php
//print_r($tax_terms);
if ($tax_terms) {
foreach ($tax_terms as $tax_term) {
$args = array (
'post_type' => $post_type,
"$tax" => $tax_term->slug,
'post_status' => 'publish',
'posts_per_page' => 2,
'caller_get_posts'=> 1,
'paged' => $paged
);
$my_query = new WP_Query($args);
?>
<?php if ( $my_query->have_posts () ) { ?>
<?php while ( $my_query->have_posts () ) : $my_query->the_post(); $count++; global $post; ?>
<?php include (TEMPLATEPATH . '/_framework/includes/portContent.php'); ?>
<?php endwhile;?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php if (function_exists("pagination")) {
pagination($additional_loop->max_num_pages);
} ?>
有什么想法吗?
答案 0 :(得分:0)
试试这个:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;