我有一个页面,我想在其中排除我帖子上的所有图片附件的显示。
我使用了这段代码,但它不起作用:
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
if (($attachment->post_mime_type!="image/png") || ($attachment->post_mime_type!="image/jpg")) {
echo substr(apply_filters('the_title', $attachment->post_title), 0, 25);
echo '.zip';
echo ' - (';
echo _format_bytes(filesize( get_attached_file( $attachment->ID ) ));
echo ')';
}
}
}