Adjustments to Next and Previous links on single items page navigation.

This commit is contained in:
mateuswetah 2020-07-19 14:37:00 -03:00
parent 827f035b25
commit d3d3ce363e
3 changed files with 46 additions and 29 deletions

View File

@ -912,6 +912,9 @@
flex-wrap: nowrap;
align-items: center;
}
a:hover {
text-decoration: none;
}
a[rel=prev]:hover {
left: -7px;
}
@ -923,7 +926,7 @@
width: auto;
margin: 0.5rem;
}
a.has-large-thumbnail {
a.has-large-thumbnail>div {
display: flex;
flex-direction: column;
align-items: center;

File diff suppressed because one or more lines are too long

View File

@ -1,33 +1,41 @@
<?php
$previous = '<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-30px"></i>&nbsp; %link';
$next = '%link &nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-30px"></i>';
//Get the links to the Previous and Next Post
$previous_link_url = get_permalink( get_previous_post() );
$next_link_url = get_permalink( get_next_post() );
//Get the title of the previous post and next post
$previous_title = get_the_title( get_previous_post() );
$next_title = get_the_title( get_next_post() );
$previous = '';
$next = '';
switch (get_theme_mod('tainacan_single_item_navigation_options', 'none')) {
case 'link':
$previous = '<a rel="prev" href="' . $previous_link_url . '"><i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-30px"></i>&nbsp; ' . $previous_title . '</a>';
$next = '<a rel="next" href="' . $next_link_url . '">' . $next_title . ' &nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-30px"></i></a>';
break;
case 'thumbnail_small':
//Get the thumnail url of the previous and next post
$previous_thumb = get_the_post_thumbnail_url( get_previous_post(), 'tainacan-small' );
$next_thumb = get_the_post_thumbnail_url( get_next_post(), 'tainacan-small' );
//Get the links to the Previous and Next Post
$previous_link_url = get_permalink( get_previous_post() );
$next_link_url = get_permalink( get_next_post() );
//Get the title of the previous post and next post
$previous_title = get_the_title( get_previous_post() );
$next_title = get_the_title( get_next_post() );
// Creates the links
$previous = '<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-30px"></i>&nbsp;' .
'<a class="has-small-thumbnail" rel="prev" href="' . $previous_link_url . '">' . $previous_title .
'<img src="' . $previous_thumb . '" alt="">' .
$previous =
'<a class="has-small-thumbnail" rel="prev" href="' . $previous_link_url . '">' .
'<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-30px"></i>&nbsp;' .
$previous_title . '<img src="' . $previous_thumb . '" alt="">' .
'</a>';
$next = '<a class="has-small-thumbnail" rel="next" href="' . $next_link_url . '">' .
$next =
'<a class="has-small-thumbnail" rel="next" href="' . $next_link_url . '">' .
'<img src="' . $next_thumb . '" alt="">' . $next_title .
'</a>' . '&nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-30px"></i>';
'&nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-30px"></i>' .
'</a>';
break;
case 'thumbnail_large':
//Get the thumnail url of the previous and next post
$previous_thumb = get_the_post_thumbnail_url( get_previous_post(), 'tainacan-medium' );
@ -42,26 +50,32 @@
$next_title = get_the_title( get_next_post() );
// Creates the links
$previous = '<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-36px"></i>&nbsp;' .
$previous =
'<a class="has-large-thumbnail" rel="prev" href="' . $previous_link_url . '">' .
'<img src="' . $previous_thumb . '" alt="">' . $previous_title .
'<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-36px"></i>&nbsp;' .
'<div><img src="' . $previous_thumb . '" alt="">' . $previous_title .
'</div></a>';
$next =
'<a class="has-large-thumbnail" rel="next" href="' . $next_link_url . '">' .
'<div><img src="' . $next_thumb . '" alt="">' . $next_title .
'</div>&nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-36px"></i>' .
'</a>';
$next = '<a class="has-large-thumbnail" rel="next" href="' . $next_link_url . '">' .
'<img src="' . $next_thumb . '" alt="">' . $next_title .
'</a>' . '&nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-36px"></i>';
break;
case 'none':
default:
return '';
}
?>
<div id="item-single-navigation" class="d-flex margin-pagination justify-content-between mt-0">
<div class="pagination">
<?php previous_post_link($previous); ?>
</div>
<div class="pagination">
<?php next_post_link($next); ?>
<div class="tainacan-single-post">
<h2 class="title-content-items"><?php echo __('Also in this collection', 'tainacan-interface') ?></h2>
<div id="item-single-navigation" class="d-flex justify-content-between margin-two-column">
<div class="pagination">
<?php previous_post_link($previous); ?>
</div>
<div class="pagination">
<?php next_post_link($next); ?>
</div>
</div>
</div>