• Resolved kbam7

    (@kbam7)


    Hello!

    INTRO
    I am trying to edit a template file called bldr-services.php but i cannot get it to override the parent file. As far as i can tell, it comes down to the fact that in the parent functions.php, the call for the file has the path get_template_directory() instead of get_stylesheet_directory(). If i change the call to use get_stylesheet_directory() then i am able to override the template successfully in my child theme. The problem there is that when the theme updates, i will lose the changes. I need to find a way to make it a permanent fix/change.

    DETAILS
    I am using the free theme called BLDR. I have created a child theme and it works as it should. When i try to override the file theme-dir/widgets/bldr-services.php by placing a copy of it in child-theme-dir/widgets/bldr-services.php it does not override. Even if i place the file in the root of the child theme it doesn’t work.

    After looking in the parent themes functions.php i found that the path to file uses the template directory and not the stylesheet directory. So when i try to override the template, it reads the parent theme directory and not the child theme directory. Here is the code from the parent functions.php:

    /**
     * Load the front page widgets.
     */
    if ( function_exists('siteorigin_panels_activate') ) {
    	require get_template_directory() . "/widgets/bldr-clients.php";
    	require get_template_directory() . "/widgets/bldr-projects.php";
    	require get_template_directory() . "/widgets/bldr-testimonials.php";
    	require get_template_directory() . "/widgets/bldr-services.php";
    	require get_template_directory() . "/widgets/bldr-home-news.php";
    	require get_template_directory() . "/widgets/bldr-cta.php";
    	require get_template_directory() . "/widgets/bldr-columns.php";
    
    }

    If i change this to the following code below, then i am able to override the file by placing a copy in my child theme:

    /**
     * Load the front page widgets.
     */
    if ( function_exists('siteorigin_panels_activate') ) {
    	require get_stylesheet_directory() . "/widgets/bldr-clients.php";
    	require get_stylesheet_directory() . "/widgets/bldr-projects.php";
    	require get_stylesheet_directory() . "/widgets/bldr-testimonials.php";
    	require get_stylesheet_directory() . "/widgets/bldr-services.php";
    	require get_stylesheet_directory() . "/widgets/bldr-home-news.php";
    	require get_stylesheet_directory() . "/widgets/bldr-cta.php";
    	require get_stylesheet_directory() . "/widgets/bldr-columns.php";
    
    }

    Problem here is when the theme updates, the functions.php loses the changes.

    Is there a way to override this code in my child themes functions.php?
    Is there maybe a work around for a situation like this?

    I really appreciate any responses. I have looked all over for a solution, but none that i could find are accurate to this specific problem.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author modernthemesnet

    (@modernthemesnet)

    kbam7,

    We don’t include any template file called bldr-services.php

    We do include a file called template-services.php, which you should be able to override very simply with a child theme. If you are trying to override the services template, please call it template-services.php rather than bldr-services.php

    Thanks!

    Thread Starter kbam7

    (@kbam7)

    Hi there modernthemesnet, thank you for getting back to me.

    I am not sure which theme you are looking at or maybe I confused you, my apologies. If you look at the sidebar on the right of this page. Under “About this theme” there are three options; “BLDR”, “Support Threads” and “Reviews”. If you select “BLDR”, you will go to the BLDR download page in the www.ads-software.com theme directory.

    Upon downloading the theme, unzip it and navigate to where you can see your “template-services.php” page and other pages. From here, find a folder called “Widgets”. In the “Widgets” folder you will find a file called “bldr-services.php” along with other files starting with “bldr-“.

    The file which i need help with is here. It is named “bldr-services.php”.

    Thank you sir. I look forward to your response and a possible solution.

    Thread Starter kbam7

    (@kbam7)

    Good Day,

    Are you able to assist me? Its been almost a week since you last replied.

    Hello kbam7,
    I can see the “bldr-services.php” file… it’s indeed located in the “widgets” folder.

    Anyway — I wanted to say that I’ve managed to customise the bldr-widgets by creating new ones in my child theme and letting the original ones stay; in this way, a theme upgrade won’t overwrite anything.
    I just wrote the new widgets using the original ones as a template, and then declared the new widgets in my child theme’s functions file.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘BLDR Theme – Override template in subdirectory’ is closed to new replies.