add post nav links with thumbnails

This commit is contained in:
Evan Mullins 2022-12-05 13:49:07 -05:00
parent 72b20a1b67
commit 381601313b
2 changed files with 66 additions and 1 deletions

View file

@ -682,6 +682,9 @@ function wasmo_entry_footer() {
$tags_list
); // WPCS: XSS OK.
}
wasmo_post_navi();
}
// Comment count.
@ -708,6 +711,49 @@ function wasmo_entry_footer() {
);
}
function wasmo_post_navi() {
// if( !is_singular('post') ) {
// return;
// }
$prev_post = get_previous_post();
$next_post = get_next_post();
?>
<h4 class="post-pagination">
<span class="post-pagination-link post-pagination-prev">
<?php
if ( $prev_post ) {
$prev_post_img = get_the_post_thumbnail(
$prev_post->ID,
'medium',
array('class' => 'pagination-prev')
);
previous_post_link(
'%link',
twentynineteen_get_icon_svg( 'chevron_left', 22 ) . 'Previous Post<br>%title' . $prev_post_img
);
}
?>
</span>
<span class="post-pagination-link post-pagination-next">
<?php
if ( $next_post ) {
$next_post_img = get_the_post_thumbnail(
$next_post->ID,
'medium',
array('class' => 'pagination-next')
);
next_post_link(
'%link',
'Next Post '.twentynineteen_get_icon_svg( 'chevron_right', 22 ).'<br>%title' . $next_post_img
);
}
?>
</span>
</h4>
<?php
}
function wasmo_excerpt_link() {
return '<a class="more-link button button-small" href="' . get_permalink() . '">Read more</a>';

View file

@ -5,7 +5,7 @@
Author: Evan Mullins
Author URI: https://circlecube.com
Template: twentynineteen
Version: 1.10.16
Version: 1.10.17
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wasmo
@ -1196,4 +1196,23 @@ div.lwa-modal-overlay div.lwa-modal-popup {
}
.user-spotlight .spotlight-thumb img {
display: block;
}
.post-pagination {
display: flex;
justify-content: space-between;
}
.post-pagination-link {
flex: 1;
}
.post-pagination-prev {
padding-right: 2rem;
}
.post-pagination-next {
padding-left: 2rem;
text-align: right;
}
.post-pagination .post-pagination-link.post-pagination-next .svg-icon {
margin-right: 0;
}