我有画廊帖子,价值帖子是meta帖子中的图片,我想像这样fiddle作此帖子,但我不知道该怎么做,我曾尝试使用此代码
<?php
while ( have_posts() ) : the_post();
global $post;
$val = get_post_meta($post->ID,'value_gallery',false);
$args = array(
'posts_per_page' => 6,
'order' => 'ASC',
'post_mime_type' => 'image',
// 'post_parent' => the_ID(),
);
$attachments = get_children( $args );
if ( $attachments ) {
foreach ($val as $key ) {
$keys = explode(",", $key);
foreach ($keys as $values) {
?>
<div class="col-lg-4">
<?php echo wp_get_attachment_image( $values, "cherry-thumb-a", array( "class" => "img-responsive" ) ); ?>
</div>
<?php
}
}
}
?>
<!-- pagination -->
<div class="nav-pagination">
<?php the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => __( '<', 'textdomain' ),
'next_text' => __( '>', 'textdomain' ),) );
?>
</div>
但是分页导航没有显示,并且显示项目仍未在每页显示6条,如果有人可以帮助我,我将很高兴