Uses new function tainacan_is_view_mode_enabled to check if slideshow is active before offering shortcut to open slideshow from current item

This commit is contained in:
mateuswetah 2020-08-10 15:56:29 -03:00
parent 24a70a4208
commit bdb514d5d3
3 changed files with 28 additions and 16 deletions

View File

@ -63,8 +63,6 @@
flex-shrink: 0;
padding: 0.6rem 1.5rem;
text-align: left;
color: #1d1d1d;
text-decoration: none !important;
position: relative;
p {
@ -73,9 +71,14 @@
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
a,
a:hover {
color: #1d1d1d !important;
text-decoration: none !important;
}
}
button.slideshow-icon {
.slideshow-icon {
border: none;
background: none;
box-shadow: none;
@ -89,7 +92,7 @@
}
&:hover,
&:focus {
button.slideshow-icon {
.slideshow-icon {
transform: scale(1.0);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,32 +1,41 @@
<?php if ( have_posts() ) : ?>
<?php
$is_slideshow_available = false;
if (function_exists('tainacan_is_view_mode_enabled'))
$is_slideshow_available = tainacan_is_view_mode_enabled('slideshow');
?>
<?php if ( have_posts() ) : ?>
<div class="tainacan-grid-container">
<?php $item_index = 0; while ( have_posts() ) : the_post(); ?>
<a class="tainacan-grid-item" href="<?php the_permalink(); ?>">
<div class="tainacan-grid-item">
<div class="metadata-title">
<p><?php the_title(); ?></p>
<a href="?<?php echo $_SERVER['QUERY_STRING'] ?>&slideshow-from=<?php echo $item_index ?>" class="icon slideshow-icon">
<i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-125em"></i>
</a>
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php if ( $is_slideshow_available ) : ?>
<a href="?<?php echo $_SERVER['QUERY_STRING'] ?>&slideshow-from=<?php echo $item_index ?>" class="icon slideshow-icon">
<i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-125em"></i>
</a>
<?php endif; ?>
</div>
<?php if ( has_post_thumbnail() ) : ?>
<div
<a
href="<?php the_permalink(); ?>"
style="background-image: url(<?php the_post_thumbnail_url( 'tainacan-medium' ) ?>)"
class="grid-item-thumbnail">
<?php the_post_thumbnail( 'tainacan-medium' ); ?>
<div class="skeleton"></div>
</div>
</a>
<?php else : ?>
<div
<a
href="<?php the_permalink(); ?>"
style="background-image: url(<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/thumbnail_placeholder.png'?>)"
class="grid-item-thumbnail">
<?php echo '<img alt="', esc_attr_e('Thumbnail placeholder', 'tainacan-interface'), '" src="', esc_url(get_template_directory_uri()), '/assets/images/thumbnail_placeholder.png">'?>
<div class="skeleton"></div>
</div>
</a>
<?php endif; ?>
</a>
</div>
<?php $item_index++; endwhile; ?>