是的。您需要在查询中获取/设置$,如下所示:
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$args = array(
\'numberposts\' => 15,
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
\'post_type\' => \'attachment\',
\'post_mime_type\' => \'image\',
\'post_parent\' => $post->ID,
\'paged\' => $paged
); ?>
<?php $photos = new WP_Query($args); ?>
<?php if ( $photos->have_posts() ) : ?>
<?php while ( $photos->have_posts() ) : $photos->the_post(); ?>
<?php $url = wp_get_attachment_image_src($post->ID); ?>
<a href="<?php echo $url[0]; ?>" target="_blank" class="lightbox" rel="[<?php echo $post->ID; ?>]"><?php echo wp_get_attachment_image($post->ID,\'thumbnail\'); ?></a>
<?php endwhile; ?>
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', get_pagenum_link( $big ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $photos->max_num_pages
) );
endif;
?>