<ul>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID, // any parent
'caption' => $post->post_excerpt
) ;
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
//if ( 'caption' == 'Ceahlau') {
echo '<li>';
echo wp_get_attachment_image( $attachment->ID, 'full' );
echo '<p>';
echo apply_filters( 'the_title', $attachment->post_title );
echo apply_filters( 'the_excerpt', $attachment->post_excerpt );
echo '</p></li>';
// }
}
}
endwhile; endif;?>
</u>
我想添加评论的if条件,但我不知道...你能帮我吗?在这种形式下,该功能正在运行,但如果我取消注释该条件,它不发布任何内容......
答案 0 :(得分:0)
if ( $args['caption'] == 'Ceahlau')