我想制作一个归档页面,将所有上传的图像拉入该站点。我正在使用当前脚本。它在某种程度上分页,但不显示所有图像。显示140个中有90个左右。
<?php query_posts(array(\'posts_per_page\'=>\'8\',\'paged\' => get_query_var(\'paged\'))); ?>
<?php
if ( $images = get_posts(array(
\'post_parent\' => $post_id,
\'post_type\' => \'attachment\',
\'numberposts\' => -1,
\'orderby\' => \'rand\',
\'posts_per_page\'=>\'8\',
\'paged\' => $paged,
\'post_mime_type\' => \'image\',)))
{
foreach( $images as $image ) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image_src( $image->ID, postgallery );
$imageDescription = apply_filters( \'the_description\' , $image->post_content );
$imageTitle = apply_filters( \'the_title\' , $image->post_title );
if (!empty($imageDescription)) {
echo \'<a href="\'.$imageDescription .\'"><img src="\' . $attachmentimage[0] . \'" alt="" /></a>\';
} else { echo \'
<div class="span3_3">
<div class="widget">
<div class="well">
<div class="view">
<a href="\' .get_attachment_link($image->ID). \'" class="view-back" style="display: none;"></a>
<img src="\' . $attachmentimage[0] . \'" alt="" />
</div>
</div>
</div>
</div>
\'; } }
} else {
echo "No Image";
} ?>
</div>
<div class=\'pagination pagination-centered\'><ul><li>
<!--Pagination-->
<?php echo paginate_links( $args ) ?>
<?php
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'total\' => $wp_query->max_num_pages
) );
?>
</li></ul></div>