Select Page

In order to create an infinite loop on the Post Navigation module, so that your “Previous/Next” buttons continue on after the first/last posts, you can try the following:

  1. Upload the Loop Post Navigation Links plugin.
  2. Modify the Posts Navigation Module in your Child Theme
    • Copy the PostsNavigation.php from Divi/includes/builder/module folder
    • Paste file into custom-modules folder inside your Divi Child Theme folder (if you do not have a folder named “custom-modules”, create one)
    • Rename the pasted file to customPostsNavigation.php
  3. Open customPostsNavigation.php and replace this line (at the very top):
    class ET_Builder_Module_Posts_Navigation extends ET_Builder_Module
    class custom_ET_Builder_Module_Posts_Navigation extends ET_Builder_Module
  4. Next, replace: $this->vb_support = ‘on’; with $this->vb_support = ‘off’;
  5. Then, comment out this line from the bottom: new ET_Builder_Module_Blog();
  6. Now find get_next_post and replace with c2c_get_next_or_loop_post (around line 260)
  7. Then, find get_previous_post and replace with c2c_get_previous_or_loop_post (around line 284)
  8. Save customPostsNavigation.php
  9. Lastly, add the following code to your functions.php file.
function divi_custom_postnav_module() {
get_template_part( 'custom-modules/customPostsNavigation' );
$dcfm = new custom_ET_Builder_Module_Posts_Navigation();
remove_shortcode( 'et_pb_post_nav' );
add_shortcode( 'et_pb_post_nav', array( $dcfm, '_shortcode_callback' ) ); }add_action( 'et_builder_ready', 'divi_custom_postnav_module' );function divi_custom_postnav_class( $classlist ) {
// Posts Navigation Module 'classname' overwrite.
$classlist['et_pb_post_nav'] = array( 'classname' => 'custom_ET_Builder_Module_Posts_Navigation',);
return $classlist;
}add_filter( 'et_module_classes', 'divi_custom_postnav_class' );