Improvements to grid view mode.
This commit is contained in:
parent
bd0f07b769
commit
5ca1fa4008
|
@ -2,16 +2,29 @@
|
||||||
$is_slideshow_available = false;
|
$is_slideshow_available = false;
|
||||||
if (function_exists('tainacan_is_view_mode_enabled'))
|
if (function_exists('tainacan_is_view_mode_enabled'))
|
||||||
$is_slideshow_available = tainacan_is_view_mode_enabled('slideshow');
|
$is_slideshow_available = tainacan_is_view_mode_enabled('slideshow');
|
||||||
|
|
||||||
|
function get_item_link_for_navigation($item_url, $index) {
|
||||||
|
if ( $_GET && isset($_GET['paged']) && isset($_GET['perpage']) ) {
|
||||||
|
$query = '';
|
||||||
|
$perpage = (int)$_GET['perpage'];
|
||||||
|
$paged = (int)$_GET['paged'];
|
||||||
|
$index = (int)$index;
|
||||||
|
$query .= '&pos=' . ( ($paged - 1) * $perpage + $index );
|
||||||
|
$query .= '&source_list=' . (is_tax() ? 'term' : ((!isset($collection_id) || empty($collection_id)) ? 'repository': 'collection') );
|
||||||
|
return $item_url . '?' . $_SERVER['QUERY_STRING'] . $query;
|
||||||
|
}
|
||||||
|
return $item_url;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ( have_posts() ) : ?>
|
<?php if ( have_posts() ) : ?>
|
||||||
<div class="tainacan-grid-container">
|
<div class="tainacan-grid-container">
|
||||||
|
|
||||||
<?php $item_index = 0; while ( have_posts() ) : the_post(); ?>
|
<?php $item_index = 0; while ( have_posts() ) : the_post(); ?>
|
||||||
|
|
||||||
<div class="tainacan-grid-item">
|
<div class="tainacan-grid-item">
|
||||||
|
|
||||||
<div class="metadata-title">
|
<div class="metadata-title">
|
||||||
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
|
<p><a href="<?php echo get_item_link_for_navigation(get_permalink(), $item_index); ?>"><?php the_title(); ?></a></p>
|
||||||
<?php if ( $is_slideshow_available ) : ?>
|
<?php if ( $is_slideshow_available ) : ?>
|
||||||
<a href="<?php echo esc_url('?' . $_SERVER['QUERY_STRING'] . '&slideshow-from=' . $item_index ); ?>" class="icon slideshow-icon">
|
<a href="<?php echo esc_url('?' . $_SERVER['QUERY_STRING'] . '&slideshow-from=' . $item_index ); ?>" class="icon slideshow-icon">
|
||||||
<i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-125em"></i>
|
<i class="tainacan-icon tainacan-icon-viewgallery tainacan-icon-1-125em"></i>
|
||||||
|
@ -20,7 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
<?php if ( has_post_thumbnail() ) : ?>
|
<?php if ( has_post_thumbnail() ) : ?>
|
||||||
<a
|
<a
|
||||||
href="<?php the_permalink(); ?>"
|
href="<?php echo get_item_link_for_navigation(get_permalink(), $item_index); ?>"
|
||||||
style="background-image: url(<?php the_post_thumbnail_url( 'tainacan-medium' ) ?>)"
|
style="background-image: url(<?php the_post_thumbnail_url( 'tainacan-medium' ) ?>)"
|
||||||
class="grid-item-thumbnail">
|
class="grid-item-thumbnail">
|
||||||
<?php the_post_thumbnail( 'tainacan-medium' ); ?>
|
<?php the_post_thumbnail( 'tainacan-medium' ); ?>
|
||||||
|
@ -28,7 +41,7 @@
|
||||||
</a>
|
</a>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<a
|
<a
|
||||||
href="<?php the_permalink(); ?>"
|
href="<?php echo get_item_link_for_navigation(get_permalink(), $item_index); ?>"
|
||||||
style="background-image: url(<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/thumbnail_placeholder.png'?>)"
|
style="background-image: url(<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/thumbnail_placeholder.png'?>)"
|
||||||
class="grid-item-thumbnail">
|
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">'?>
|
<?php echo '<img alt="', esc_attr_e('Thumbnail placeholder', 'tainacan-interface'), '" src="', esc_url(get_template_directory_uri()), '/assets/images/thumbnail_placeholder.png">'?>
|
||||||
|
|
Loading…
Reference in New Issue