use new templte tag to get attachments tainacan/tainacan#241

This commit is contained in:
leogermani 2019-07-25 10:32:27 -03:00
parent 5cc5de29de
commit c234a88dd6
1 changed files with 18 additions and 12 deletions

View File

@ -54,27 +54,33 @@
<?php endif; ?>
<?php
$attachment = array_values(
get_children(
array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'numberposts' => -1,
if (function_exists('tainacan_get_the_attachments')) {
$attachments = tainacan_get_the_attachments();
} else {
// compatibility with pre 0.11 tainacan plugin
$attachments = array_values(
get_children(
array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'numberposts' => -1,
)
)
)
);
);
}
?>
<?php if ( ! empty( $attachment ) ) : ?>
<?php if ( ! empty( $attachments ) ) : ?>
<div class="mt-3 tainacan-single-post">
<article role="article">
<h1 class="title-content-items"><?php _e( 'Attachments', 'tainacan-interface' ); ?></h1>
<section class="tainacan-content single-item-collection margin-two-column">
<div class="single-item-collection--attachments">
<?php foreach ( $attachment as $attachment ) { ?>
<?php foreach ( $attachments as $attachment ) { ?>
<div class="single-item-collection--attachments-img">
<a href="<?php echo $attachment->guid; ?>" data-toggle="lightbox" data-gallery="example-gallery">
<?php