How to get attachment from single page by ID, and set 12 img per page?
'post_parent' => 145, // not working, but without this param I get all attachments
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$attachment = new WP_Query( array(
'post_parent' => 145, // not working, but without this param I get all attachments
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image/jpeg,image/gif,image/jpg,image/png',
'posts_per_page' => 12,
'paged' => $paged
) );
if ( $attachment->have_posts() ) :
while ( $attachment->have_posts() ) : $attachment->the_post();
?>
<div class="gallery__item"><a href="<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>" data-fancybox><img src="<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>" alt=""></a></div>
<?php
endwhile;
wp_reset_postdata();
endif;
?>