Merge branch 'develop' into feature/theme-json

This commit is contained in:
mateuswetah 2022-09-05 11:28:34 -03:00
commit f30409aa04
2 changed files with 22 additions and 8 deletions

View File

@ -191,6 +191,7 @@ if ( ! function_exists( 'tainacan_setup' ) ) {
'slug' => 'huge'
)
) );
add_theme_support( 'appearance-tools' );
add_theme_support( 'editor-style' );
add_editor_style( 'editor-style.css' );

View File

@ -2,16 +2,29 @@
$is_slideshow_available = false;
if (function_exists('tainacan_is_view_mode_enabled'))
$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() ) : ?>
<div class="tainacan-grid-container">
<?php $item_index = 0; while ( have_posts() ) : the_post(); ?>
<div class="tainacan-grid-item">
<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 ) : ?>
<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>
@ -20,7 +33,7 @@
</div>
<?php if ( has_post_thumbnail() ) : ?>
<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' ) ?>)"
class="grid-item-thumbnail">
<?php the_post_thumbnail( 'tainacan-medium' ); ?>
@ -28,7 +41,7 @@
</a>
<?php else : ?>
<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'?>)"
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">'?>