Hi,
I would like to be able to add navigation links at the bottom of single pages.
I am able to add the code below to the child theme’s functions.php, which adds a previous/next link on posts, and I wondered if something similar might be possible on pages?
add_action ('the_content', 'add_next_post_item_link' );
function add_next_post_item_link ( $content ) {
if ( is_singular('post') ) {
$next_name = "Next Post <i class=\"x-icon-chevron-right\"></i>";
$prev_name = "<i class=\"x-icon-chevron-left\"></i> Previous Post";
$next_link = get_next_post() ? '<a style="float: left;" href="' . get_permalink( get_next_post()->ID ) . '">' . $prev_name . '</a>' : '';
$prev_link = get_previous_post() ? '<a style="float: right;" href="' . get_permalink( get_previous_post()->ID ) . '">' . $next_name . '</a>' : '';
$posts = '<div class="wp-post-navigation-next">'.$next_link.$prev_link.'</div>';
return $content . $posts;
} else {
return $content;
}
}
Very grateful for any help that can be offered here.