我有一个公文包,其中每个项目的内容中都有一些图像,一个特色图像和一个称为“公文包图像”的自定义字段。
我想通过post获取所有图像,不包括受约束的图像和内容图像。
我的代码是:
if (have_posts()) : while (have_posts()) : the_post();
$terms = wp_get_post_terms(get_the_ID(), \'portfolio-type\');
/*get the images for the slide on hover by metelidrissi*/
$args = array(
\'post_type\' => \'attachment\',
\'numberposts\' => -1,
\'post_status\' => null,
\'post_parent\' => get_the_ID()
);
$attachments = get_posts( $args );
$attachments_portfolio = array();
if ( $attachments ) {
$i = 0;
foreach ( $attachments as $attachment ) {
var_dump($attachment);
$attachments_portfolio[$i] = $attachment->guid;
$i++;
}
}
我只想在他的领域里拍摄图像:我该怎么办?有一个wat来排除内容帖子上的图片和特色图片吗?谢谢