Skip to content

Commit

Permalink
use new templte tag to get attachments tainacan/tainacan#241
Browse files Browse the repository at this point in the history
  • Loading branch information
leogermani committed Jul 25, 2019
1 parent 5cc5de2 commit c234a88
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/tainacan/single-items.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c234a88

Please sign in to comment.