我正在尝试将post拆分为两列。第一列将是附加到帖子的任何图像,右列将是the_content()
(不包括图像)。
所以到目前为止,我提取所有图像都没有问题。然而,我似乎看不到图片的标题或描述。
这是我的代码:(这是进入一个页面)
<?php if ( $images = get_posts(array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'numberposts' => -1,
'orderby' => 'title',
'order' => 'ASC',
'post_mime_type' => 'image',
)))
{
foreach( $images as $image ) {
$attachmenturl = wp_get_attachment_url($image->ID);
$attachmentimage = wp_get_attachment_image_src( $image->ID, full );
$imageDescription = apply_filters( 'the_description' , $image->post_content );
$imageTitle = apply_filters( 'the_title' , $image->post_title );
$i++;
if (!empty($imageTitle)) {
echo '<div class="client-img-item ci-'.$count++.'"><img src="' . $attachmentimage[0] . '" alt="'.$imageTitle.'" /> <div class="CAPS client-img-caption"><span class="red arrow-lrg">»</span> '.$imageDescription.'</div></div><div class="sml-dots"></div>';
} else { echo '<img src="' . $attachmentimage[0] . '" alt="" />' ; }
}
} else {
echo 'No Image Found';
}?>
这有助于保持原始格式:大写和空格吗?
apply_filters( 'the_description' , $image->post_content );
当将我的照片定位到下一个图库时,描述tekst会发生变化:大写/小写等。。空白和删除末尾的点等等。。。任何人