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' 'slug' => 'huge'
) )
) ); ) );
add_theme_support( 'appearance-tools' );
add_theme_support( 'editor-style' ); add_theme_support( 'editor-style' );
add_editor_style( 'editor-style.css' ); add_editor_style( 'editor-style.css' );

View File

@ -1,17 +1,30 @@
<?php <?php
$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">'?>