• Resolved cyberlp23

    (@cyberlp23)


    Hello,
    My parent’s theme has a line (not part of a function):
    include (get_template_directory().'/includes/widgets/file.php');
    Is there a way not to include this file, using the child theme?
    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • why you want to disable this include? is there any functionality on that file that you want to remove?

    Thread Starter cyberlp23

    (@cyberlp23)

    Because I’d like to rewrite this widget script, just keeping a few lines & functions here & there.
    As I couldn’t find a way to remove this file, what I did is unregister the parent’s widget and register a new one copied from the old one but modified:

    add_action( 'after_setup_theme', 'remove_tabs_widget', 11 );
    function remove_tabs_widget(){
    remove_action( 'widgets_init', 'bd_tabs_widget' );
    register_widget( 'child_tabs_widget' );
    }
    include(get_stylesheet_directory().'/includes/widgets/child_tabs.php');

    But then it seems I have to modify the widget script so that, even though the parent widget has been removed, the class extending WP_Widget {} in the child script doesn’t bear the same name as the parent’s. I don’t know why ??

    what i would do in your case is extend the current Widget and add my changes to the child class, also you can unregister the widget you don’t want to use and leave your child widget

    Thread Starter cyberlp23

    (@cyberlp23)

    Ok, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove a parent theme include?’ is closed to new replies.