Adds option to display as gallery the attachments list. #27
This commit is contained in:
parent
697224800f
commit
98fe0e83ca
|
@ -69,7 +69,64 @@ jQuery( document ).ready(function( $ ) {
|
|||
slidesToScroll: 1,
|
||||
arrows: false,
|
||||
fade: true,
|
||||
asNavFor: '.single-item-collection--attachments'
|
||||
adaptiveHeight: true,
|
||||
asNavFor: '.single-item-collection--gallery-items'
|
||||
});
|
||||
|
||||
$( '.single-item-collection--gallery-items' ).slick({
|
||||
asNavFor: '.single-item-collection--gallery',
|
||||
prevArrow: '<button type="button" data-role="none" class="single-item-collection--attachments-prev" aria-label="Previous" role="button" style="display: block;"><i class="tainacan-icon tainacan-icon-arrowleft"></i></button>',
|
||||
nextArrow: '<button type="button" data-role="none" class="single-item-collection--attachments-next" aria-label="Next" role="button" style="display: block;"><i class="tainacan-icon tainacan-icon-arrowright"></i></button>',
|
||||
slidesToShow: 7,
|
||||
slidesToScroll: 1,
|
||||
autoplay: false,
|
||||
autoplaySpeed: 2000,
|
||||
responsive: [ {
|
||||
breakpoint: 1330,
|
||||
settings: {
|
||||
slidesToShow: 6,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 1200,
|
||||
settings: {
|
||||
slidesToShow: 5,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 1024,
|
||||
settings: {
|
||||
slidesToShow: 4,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 820,
|
||||
settings: {
|
||||
slidesToShow: 3,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 640,
|
||||
settings: {
|
||||
slidesToShow: 2,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
breakpoint: 460,
|
||||
settings: {
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1
|
||||
}
|
||||
}
|
||||
// You can unslick at a given breakpoint now by adding:
|
||||
// settings: "unslick"
|
||||
// instead of a settings object
|
||||
]
|
||||
});
|
||||
|
||||
$( '.single-item-collection--attachments' ).slick({
|
||||
|
|
|
@ -462,6 +462,12 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
.single-item-collection--gallery {
|
||||
.tainacan-content {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.single-item-collection--gallery-items,
|
||||
.single-item-collection--attachments {
|
||||
.single-item-collection--attachments-file {
|
||||
margin: 10px;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -93,10 +93,54 @@
|
|||
</h1>
|
||||
|
||||
<section class="tainacan-content single-item-collection margin-two-column">
|
||||
<?php if (get_theme_mod( 'tainacan_single_item_gallery_mode', false )): ?>
|
||||
<div class="single-item-collection--gallery">
|
||||
<?php foreach ( $attachments as $attachment ) { ?>
|
||||
<?php
|
||||
<?php if (get_theme_mod( 'tainacan_single_item_gallery_mode', false )): ?>
|
||||
<div class="single-item-collection--gallery">
|
||||
<?php foreach ( $attachments as $attachment ) { ?>
|
||||
<?php
|
||||
if ( function_exists('tainacan_get_attachment_html_url') ) {
|
||||
$href = tainacan_get_attachment_html_url($attachment->ID);
|
||||
} else {
|
||||
$href = wp_get_attachment_url($attachment->ID, 'large');
|
||||
}
|
||||
?>
|
||||
<section class="tainacan-content single-item-collection margin-two-column">
|
||||
<div class="single-item-collection--document">
|
||||
<?php
|
||||
if ( function_exists('tainacan_get_single_attachment_as_html') ) {
|
||||
tainacan_get_single_attachment_as_html($attachment->ID);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
<div class="single-item-collection--gallery-items">
|
||||
<?php foreach ( $attachments as $attachment ) { ?>
|
||||
<?php
|
||||
if ( function_exists('tainacan_get_attachment_html_url') ) {
|
||||
$href = tainacan_get_attachment_html_url($attachment->ID);
|
||||
} else {
|
||||
$href = wp_get_attachment_url($attachment->ID, 'large');
|
||||
}
|
||||
?>
|
||||
<div class="single-item-collection--attachments-file">
|
||||
<a
|
||||
class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>"
|
||||
href="<?php echo $href; ?>">
|
||||
<?php
|
||||
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
||||
echo get_the_title( $attachment->ID );
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="single-item-collection--attachments">
|
||||
<?php foreach ( $attachments as $attachment ) { ?>
|
||||
<?php
|
||||
if ( function_exists('tainacan_get_attachment_html_url') ) {
|
||||
$href = tainacan_get_attachment_html_url($attachment->ID);
|
||||
} else {
|
||||
|
@ -106,7 +150,9 @@
|
|||
<div class="single-item-collection--attachments-file">
|
||||
<a
|
||||
class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>"
|
||||
href="<?php echo $href; ?>">
|
||||
href="<?php echo $href; ?>"
|
||||
data-toggle="lightbox"
|
||||
data-gallery="example-gallery">
|
||||
<?php
|
||||
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
||||
echo get_the_title( $attachment->ID );
|
||||
|
@ -117,30 +163,6 @@
|
|||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="single-item-collection--attachments">
|
||||
<?php foreach ( $attachments as $attachment ) { ?>
|
||||
<?php
|
||||
if ( function_exists('tainacan_get_attachment_html_url') ) {
|
||||
$href = tainacan_get_attachment_html_url($attachment->ID);
|
||||
} else {
|
||||
$href = wp_get_attachment_url($attachment->ID, 'large');
|
||||
}
|
||||
?>
|
||||
<div class="single-item-collection--attachments-file">
|
||||
<a
|
||||
class="<?php if (!wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments')) echo'attachment-without-image'; ?>"
|
||||
href="<?php echo $href; ?>"
|
||||
data-toggle="lightbox"
|
||||
data-gallery="example-gallery">
|
||||
<?php
|
||||
echo wp_get_attachment_image( $attachment->ID, 'tainacan-interface-item-attachments', true );
|
||||
echo get_the_title( $attachment->ID );
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue