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

File diff suppressed because one or more lines are too long

View File

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