initialized the carousel in attachmentts of items collections

This commit is contained in:
Fabiano 2018-06-29 16:59:11 -03:00
parent 47df76dbb6
commit 3e73b46fd3
2 changed files with 60 additions and 15 deletions

View File

@ -93,4 +93,49 @@ jQuery(document).ready(function( $ ) {
$('.tainacan-list-post .table .tainacan-list-collection td').click(function(){
window.location = $('.tainacan-list-post .table .tainacan-list-collection').data("href");
});
$('.single-item-collection--attachments').slick({
dots: true,
speed: 300,
variableWidth: true,
prevArrow: '<button type="button" class="slick-prev"><i class="mdi mdi-menu-left"></i></button>',
nextArrow: '<button type="button" class="slick-next"><i class="mdi mdi-menu-right"></i></button>',
responsive: [
{
breakpoint: 1408,
settings: {
slidesToShow: 6,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 1024,
settings: {
slidesToShow: 5,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 4,
slidesToScroll: 1
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
}
// You can unslick at a given breakpoint now by adding:
// settings: "unslick"
// instead of a settings object
]
});
});

View File

@ -47,21 +47,21 @@
<article role="article">
<section class="tainacan-content single-item-collection margin-two-column">
<div class="single-item-collection--attachments">
<?php
$images = get_posts( array (
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_per_page' => -1,
'exclude' => get_post_thumbnail_id( get_the_ID() )
));
if ( empty($images) ) {
echo 'no attachments here';
} else {
foreach ( $images as $attachment ) {
echo wp_get_attachment_image( $attachment->ID, 'thumbnail' );
}
}
?>
<?php
$images = get_posts( array (
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_per_page' => -1,
'exclude' => get_post_thumbnail_id( get_the_ID() )
));
if ( empty($images) ) {
echo 'no attachments here';
} else {
foreach ( $images as $attachment ) {
echo '<div class="single-item-collection--attachments-img">' . wp_get_attachment_image( $attachment->ID, 'medium' ) . '</div>';
}
}
?>
</div>
</section>
</article>