re-added max_images check
props @mexon
This commit is contained in:
parent
6992fbbe22
commit
c06a7d44cf
1 changed files with 19 additions and 15 deletions
|
@ -88,11 +88,14 @@ class Post {
|
|||
$id = $this->post->ID;
|
||||
|
||||
$image_ids = array();
|
||||
|
||||
// list post thumbnail first if this post has one
|
||||
if ( \function_exists( 'has_post_thumbnail' ) && \has_post_thumbnail( $id ) ) {
|
||||
$image_ids[] = \get_post_thumbnail_id( $id );
|
||||
$max_images--;
|
||||
}
|
||||
|
||||
if ( $max_images > 0 ) {
|
||||
// then list any image attachments
|
||||
$query = new \WP_Query(
|
||||
array(
|
||||
|
@ -110,6 +113,7 @@ class Post {
|
|||
$image_ids[] = $attachment->ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$image_ids = \array_unique( $image_ids );
|
||||
|
||||
|
|
Loading…
Reference in a new issue