Snippets: Create A Next/Previous “Block” For Single Posts Builder


After adding the code below to the site make sure to create a partials folder
in your child theme and inside it create a "blog" folder then add a new file
called blog-single-next-prev.php to have the code for the next previous links
which you can either copy from total/partials/next-prev.php or you can include
that file in your file or you can create your own code using the WordPress posts_nav_link
function for a more simple approach.

Also you must go Appearance > Customize > Blog > Single and enable the new "Block"

function myprefix_blog_single_blocks( $blocks ) {

    // Add new next/previous block
    $blocks['next-prev'] = __( 'Next/Previous Articles', 'total' );

    // Return blocks
    return $blocks;

add_filter( 'wpex_blog_single_blocks', 'myprefix_blog_single_blocks' );

Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)