• Resolved bbtodd

    (@bbtodd)


    I need to modify the code in the footer, the code is generated by the register_sidebar function found in a file in the includes folder of the parent theme.

    I tried duplicating the file and putting it in the includes folder of the child theme and modifying that file. But it has no effect on the code.

    So 1. Am I doing something wrong? Do I need to add code at the top of the file to be sure it uses this one and not the parent file? Or 2. Is there any easier way to accomplish this? Like something I can add to functions.php?

    EDIT: It exists inside the public function widgets_init()

    public function widgets_init() {
     register_sidebar(
       ... etc ... 
      'before_title'  => '<div class="widget-title">',
      'after_title'   => '</div>',
     );
    }
    • This topic was modified 4 years, 3 months ago by bbtodd.
    • This topic was modified 4 years, 3 months ago by bbtodd.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    the code is generated by the register_sidebar function found in a file in the includes folder of the parent theme.

    I recommend asking at the parent theme’s dedicated support so that the theme’s developers and the support community can help you with this.

    Moderator bcworkz

    (@bcworkz)

    Parent theme code still executes. Only child theme templates override what parent themes do with templates only. Any other child theme code needs to use its own naming scheme to not conflict with parent theme code.

    register_sidebar() defines an area that will accept widgets, it doesn’t alter what widgets do. To alter what widgets do, see if the widget code has actions or filters that will let you change its behavior. If not, you could extend the widget’s class and define your own variant, using a new name.

    What is it you actually want to change?

    Thread Starter bbtodd

    (@bbtodd)

    Thank you for the replies, I would ask on the themes forum except you need to prove you bought the theme and I’m a contractor, I have no receipts.

    I will create my own custom widgets and direct the footer to use them instead of the theme’s default widgets.

    The problem is the default theme widget puts the title in an H4 tag and supposedly that’s bad for SEO ˉ\_(ツ)_/ˉ who knew? So I need to change the tag for the title.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing the widget code in a child theme.’ is closed to new replies.