February 11, 2024 at 5:21 pm
#1434000
Hey rqn,
If you want to hide the prev / next post navigation and add a new blog post navigation to the bottom of the posts, above the share buttons, try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:
add_filter( 'the_content', 'prev_next_post_nav' );
function prev_next_post_nav( $content ) {
if ( is_singular('post') ) {
$content .= '<div style="clear:both;"></div>';
$content .= '<div class="prev-next-nav-container">';
$content .= '<div class="prev-nav">';
$content .= get_previous_post_link();
$content .= '</div>';
$content .= '<div class="next-nav">';
$content .= get_next_post_link();
$content .= '</div>';
$content .= '</div>';
return $content;
}
else {
return $content;
}
}
Then add this CSS in your Enfold Theme Options ▸ General Styling ▸ Quick CSS field:
.prev-next-nav-container {
width: 100%;
height: 70px;
padding-top: 20px;
padding-bottom: 10px;
}
.prev-next-nav-container .prev-nav {
display: inline-block;
float: left;
border-style: solid;
border-width: 2px;
border-radius: 0px;
text-align: center;
padding: 5px;
text-decoration: none;
}
.prev-next-nav-container .next-nav {
display: inline-block;
float: right;
border-style: solid;
border-width: 2px;
border-radius: 0px;
text-align: center;
padding: 5px;
text-decoration: none;
}
.prev-next-nav-container .prev-nav:hover,
.prev-next-nav-container .next-nav:hover {
background-color: rgba(0,0,0,.2);
color: #fff;
}
.prev-next-nav-container .prev-nav:hover a,
.prev-next-nav-container .next-nav:hover a {
color: #fff;
}
.prev-next-nav-container .prev-nav a,
.prev-next-nav-container .next-nav a {
display: inline-block;
}
.prev-next-nav-container .prev-nav:empty,
.prev-next-nav-container .next-nav:empty,
.single-post .avia-post-nav.avia-post-prev,
.single-post .avia-post-nav.avia-post-next {
display: none;
}
This will make post navigation buttons like this:
The buttons only have a light styling, you can adjust to suit.
On Advanced Layout Builder posts they will show at the bottom of the post page:
Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
Best regards,
Mike