Do not shows navigation thumbnail if no thumbnail is present.

This commit is contained in:
mateuswetah 2022-10-14 11:45:25 -03:00
parent a6deb3a9b4
commit 1f807c84c8
2 changed files with 2027 additions and 39 deletions

View File

@ -61,23 +61,23 @@ if ( !function_exists('tainacan_blocksy_get_adjacent_item_links') ) {
$next_thumb = get_the_post_thumbnail_url( get_next_post(), 'tainacan-medium' ); $next_thumb = get_the_post_thumbnail_url( get_next_post(), 'tainacan-medium' );
} }
$previous_post_image_output = blocksy_simple_image( $previous_post_image_output = $previous_thumb ? blocksy_simple_image(
$previous_thumb, $previous_thumb,
[ [
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="0,7.5 5.5,13 6.4,12.1 2.4,8.1 20,8.1 20,6.9 2.4,6.9 6.4,2.9 5.5,2 "/></svg>', 'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="0,7.5 5.5,13 6.4,12.1 2.4,8.1 20,8.1 20,6.9 2.4,6.9 6.4,2.9 5.5,2 "/></svg>',
'ratio' => '1/1', 'ratio' => '1/1',
'tag_name' => 'figure' 'tag_name' => 'figure'
] ]
); ) : '';
$next_post_image_output = blocksy_simple_image( $next_post_image_output = $next_thumb ? blocksy_simple_image(
$next_thumb, $next_thumb,
[ [
'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="14.5,2 13.6,2.9 17.6,6.9 0,6.9 0,8.1 17.6,8.1 13.6,12.1 14.5,13 20,7.5 "/></svg>', 'inner_content' => '<svg width="20px" height="15px" viewBox="0 0 20 15"><polygon points="14.5,2 13.6,2.9 17.6,6.9 0,6.9 0,8.1 17.6,8.1 13.6,12.1 14.5,13 20,7.5 "/></svg>',
'ratio' => '1/1', 'ratio' => '1/1',
'tag_name' => 'figure' 'tag_name' => 'figure'
] ]
); ) : '';
} }
@ -99,7 +99,7 @@ if ( !function_exists('tainacan_blocksy_get_adjacent_item_links') ) {
'</div>' . '</div>' .
($has_thumb ? $next_post_image_output : '') . ($has_thumb ? $next_post_image_output : '') .
'</a>'); '</a>');
return ['next' => $next, 'previous' => $previous]; return ['next' => $next, 'previous' => $previous];
} }
} }
@ -187,7 +187,6 @@ if ( !function_exists('blocksy_default_post_navigation') ) {
ob_start(); ob_start();
?> ?>
<nav class="<?php echo esc_attr( $container_class ); ?>"> <nav class="<?php echo esc_attr( $container_class ); ?>">
<?php if ($next_post): ?> <?php if ($next_post): ?>
<a href="<?php echo esc_url(get_permalink($next_post)); ?>" class="nav-item-prev"> <a href="<?php echo esc_url(get_permalink($next_post)); ?>" class="nav-item-prev">
@ -268,31 +267,30 @@ if ( !function_exists('tainacan_blocksy_item_navigation') ) {
if (get_theme_mod( $prefix . '_has_post_nav', $prefix === 'single_blog_post' ? 'yes' : 'no' ) === 'yes') { if (get_theme_mod( $prefix . '_has_post_nav', $prefix === 'single_blog_post' ? 'yes' : 'no' ) === 'yes') {
$container_class = 'post-navigation'; $container_class = 'post-navigation';
$container_class .= ' ' . blocksy_visibility_classes(get_theme_mod(
$prefix . '_post_nav_visibility',
[
'desktop' => true,
'tablet' => true,
'mobile' => true,
]
));
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
if ($has_thumb) $container_class .= ' ' . blocksy_visibility_classes(get_theme_mod(
$container_class .= ' has-thumbnails'; $prefix . '_post_nav_visibility',
[
'desktop' => true,
'tablet' => true,
'mobile' => true,
]
));
$has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes';
$adjacent_links = [ if ($has_thumb)
'next' => '', $container_class .= ' has-thumbnails';
'previous' => ''
]; $adjacent_links = [
'next' => '',
$adjacent_links = tainacan_blocksy_get_adjacent_item_links(); 'previous' => ''
];
$previous = $adjacent_links['previous'];
$next = $adjacent_links['next']; $adjacent_links = tainacan_blocksy_get_adjacent_item_links();
$previous = $adjacent_links['previous'];
$next = $adjacent_links['next'];
} }

File diff suppressed because it is too large Load Diff