I have this page where I am showing all post\'s attachments.
代码如下:<?php
$args = array(
\'post_type\' => \'attachment\',
\'post_status\' => \'published\',
\'posts_per_page\' =>25,
\'post_parent\' => null, // Post-> ID;
\'numberposts\' => null,
);
$attachments = get_posts($args);
$post_count = count ($attachments);
if ($attachments) {
foreach ($attachments as $attachment) {
echo "<div class=\\"post photo col3\\">";
$url = get_attachment_link($attachment->ID);// extraigo la _posturl del attachmnet
$img = wp_get_attachment_url($attachment->ID);
$title = get_the_title($attachment->post_parent);//extraigo titulo
echo \'<a href="\'.$url.\'"><img title="\'.$title.\'" src="\'.$img.\'"></a>\';
echo "</div>";
}
}
?>
现在,我有了“post”、“page”和“videos”post\\u类型。我正在获取所有这些内容,但我只想显示“post”post\\u类型。如何排除“视频”post\\u类型?谢谢