skip to Main Content

For some reason my child theme templates are not being recognized.

I believe I have followed the correct procedure (and checked for caching etc)

/wp-content/themes/divi-child/includes/builder/module/Blog.php

should replace

/wp-content/themes/Divi/includes/builder/module/Blog.php

(same path and same file with a slight update)

The child theme module template is not recognized (changes to the child theme template have no effect)

I have tested editing the main file and this works immediately every
time.

Any advice greatly appreciated.

Cheers


EDIT

The below should work according to Divi however it breaks the site when I try.

Apparently it is not enough to just copy the module into the child theme. The file needs to be duplicated. Then copied file to child-theme/custom-modules/Blog.php. After adding following code to the bottom of the functions.php file:

function divi_custom_blog_module() {
get_template_part( '/custom-modules/Blog' );
$myblog = new custom_ET_Builder_Module_Blog();
remove_shortcode( 'et_pb_blog' );
add_shortcode( 'et_pb_blog', array( $myblog, '_render' ) );
}
add_action( 'et_builder_ready', 'divi_custom_blog_module' );

2

Answers


  1. I have got this issue similar to this before. I think – maybe the blog template is called by another file in the "father theme" folder some thing like:

    $url = dirname(__FILE__)."/includes/builder/module/Blog.php";
    

    this will cause the issue. to fix this there are two way:

    #1: find and edit the file wich is call the blog template (not recommend)

    #2: find and copy the file wich is call the blog template to your child theme (you can try with index.php, content.php or single.php first) (recommend)

    Login or Signup to reply.
  2. There are a few other steps https://intercom.help/elegantthemes/en/articles/4532734-moving-blog-module-in-child-theme

    1. Create a new folder in the child theme folder, for example, includes folder.

    2. Now copy the Divi/includes/builder/module/Blog.php file from the parent theme into the child-theme/includes/ folder.

    3. Open up the Blog.php file of your child theme and replace this line (at the very top):

        require_once 'helpers/Overlay.php';
            
        class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
    

    with:

        get_template_part( '/includes/builder/module/helpers/Overlay.php' );
        
        class custom_ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
    

    Replace: $this->vb_support = ‘on’; with $this->vb_support = ‘off’;

    Remove this line from the bottom: new ET_Builder_Module_Blog();

    1. Finally, add the following code to the functions.php file in your child theme folder:
    
    /*================================================
    
    #Load custom Blog  Module
    
    ================================================*/
    
    function divi_custom_blog_module() {
    
        get_template_part( '/includes/Blog' );
    
        $myblog = new custom_ET_Builder_Module_Blog();
    
        remove_shortcode( 'et_pb_blog' );
    
        add_shortcode( 'et_pb_blog', array( $myblog, '_render' ) );
    
    }
    
    add_action( 'et_builder_ready', 'divi_custom_blog_module' );
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search