| 1 |
<?php |
| 2 |
/** |
| 3 |
* Load a list of images with the posts they are displayed in. |
| 4 |
* |
| 5 |
* @var WP_Query $images_with_posts query with posts that have the "isc_image_posts" post meta. |
| 6 |
*/ |
| 7 |
?> |
| 8 |
<table class="widefat isc-table isc-table-debug-list" style="width: 80%;" > |
| 9 |
<thead> |
| 10 |
<tr> |
| 11 |
<th><?php esc_html_e( 'Image', 'image-source-control-isc' ); ?></th> |
| 12 |
<th><?php esc_html_e( 'Posts', 'image-source-control-isc' ); ?></th> |
| 13 |
<th><?php esc_html_e( 'Actions', 'image-source-control-isc' ); ?></th> |
| 14 |
</tr> |
| 15 |
</thead><tbody> |
| 16 |
<?php |
| 17 |
|
| 18 |
while ( $images_with_posts->have_posts() ) : |
| 19 |
$images_with_posts->the_post(); |
| 20 |
$_posts = get_post_meta( get_the_ID(), 'isc_image_posts', true ); |
| 21 |
if ( is_array( $_posts ) && count( $_posts ) > 0 ) : |
| 22 |
?> |
| 23 |
<tr> |
| 24 |
<td> |
| 25 |
<?php edit_post_link( get_the_title(), '', '', get_the_ID() ); ?> |
| 26 |
</td> |
| 27 |
<td> |
| 28 |
<ul> |
| 29 |
<?php |
| 30 |
foreach ( $_posts as $_post_id ) : |
| 31 |
// skip if this is a revision. |
| 32 |
if ( wp_is_post_revision( $_post_id ) ) { |
| 33 |
continue; |
| 34 |
} |
| 35 |
?> |
| 36 |
<li><a href="<?php echo esc_url( get_edit_post_link( $_post_id ) ); ?>"><?php echo esc_html( get_the_title( $_post_id ) ); ?></a></li> |
| 37 |
<?php endforeach; ?> |
| 38 |
</ul> |
| 39 |
</td> |
| 40 |
<td> |
| 41 |
<button type="button" class="button isc-button-delete-image-posts-index" data-image-id="<?php echo absint( get_the_ID() ); ?>"> |
| 42 |
<?php esc_html_e( 'Delete', 'image-source-control-isc' ); ?> |
| 43 |
</button> |
| 44 |
</td> |
| 45 |
</tr> |
| 46 |
<?php endif; ?> |
| 47 |
<?php endwhile; ?> |
| 48 |
</tbody></table> |
| 49 |
<?php |
| 50 |
|