-
AuthorPosts
-
August 25, 2016 at 3:30 am #677299
I would like to override the register_custom_sidebars function that is in the parent theme framework/php/class-sidebar-generator.php file for the simple reason of changing the sidebar widget titles from h3 to h4. I know that I could accomplish the same end result by using the context of the sidebar h3 tags to change the size, but that really defeats the purpose of having different sized heading tags. Is there a way to do this override without replacing the parent theme’s function.php with a child theme function.php and not loading the parent? That requires copying a lot of other files to the child as well, which would pretty much negate the possibility of having any upgrades being used.
Thanks for any help you can offer.
August 29, 2016 at 8:17 am #678759Hi rwwood!
Thank you for using Enfold.
Use the “avia_custom_widget_args” filter. Please add this in the functions.php file:
add_filter('avia_custom_widget_args', 'avia_custom_widget_args_mod', 10, 1); function avia_custom_widget_args_mod($args) { $args['before_title'] = '<h3 class="widgettitle">'; $args['after_title'] = '</h4>'; return $args; }
Cheers!
IsmaelAugust 30, 2016 at 1:55 am #679227removed
September 1, 2016 at 6:01 am #680472Hi,
If you can’t submit a new post then please post your other problem here. It works for other users so you might be able to if you try again.
Best regards,
RikardSeptember 12, 2016 at 9:44 pm #685381Ismael,
This is not working, even after changing your typo in the “before” line to h4 rather than h3.
Technically, if this works the way I think it should, the h4 should need no class name since all h4s on the site would have the same attributes as far as size, color, font, etc, and would only need a class if I wanted to change some attribute for a specific heading, but the size would not be one of those. Heading tags inherently have the size built in, or are supposed to.
Thanks.
- This reply was modified 8 years, 2 months ago by rwwood.
September 15, 2016 at 6:32 am #686726Hi!
It works on my installation. Could you please provide a link to the page with the issue?
Cheers!
IsmaelSeptember 15, 2016 at 1:29 pm #686862You’ll have to log in as admin to see the front page because I have it closed to the public at present. Then, I’m trying to switch the widget header titles in the sidebar to h4 rather than h3.
Thanks.
September 19, 2016 at 7:13 am #688311Hey!
I’m sorry but I can’t find the header widget. I created a custom widget area in the Appearance > Widgets panel and then created a test page. The filter is working because the heading is set to h4. http://richardwwood.com/tests/
Did you modify all those files in the child theme folder? And did you create change logs or notes about those modifications?
Best regards,
IsmaelSeptember 19, 2016 at 8:02 pm #688744I’m not sure what you mean by you can’t find the header widget. I don’t have a widget in the actual header. The h tags are in the sidebar where you put your test. But I notice that only that first title is h4, with the rest being h3.
My whole goal it to make all h3s, for example, the same size without additional size related css. In reality, that’s how sizing for header tags, with only the colors, font or styling perhaps being changed. So, code that only affects one of the widget header tags isn’t what I’m trying to do.
As to annotations, I believe that I’ve noted everything except for perhaps some code given me by support that I see in the single.php file. Actually, I think it’s a copy of index.php with a few changes made. I had moved the sidebar.php file into the child theme thinking I would need to modify it for the widget title names and not deleting it when I realized I didn’t.
I hope this helps define what I’m trying to do and that there’s a way to do it easily.
Thanks.
September 22, 2016 at 5:17 am #690047Hey!
The h tags are in the sidebar where you put your test. But I notice that only that first title is h4, with the rest being h3.
The filter will only work if the widgets are inside a custom widget area. If you need every widget area to have the title as h4, edit the includes > register-widget-area.php file.
Cheers!
IsmaelSeptember 24, 2016 at 7:42 am #691099That file is in includes/admin/ How do I handle the child theme directory structure and function to override that file in the parent theme?
Thanks.
- This reply was modified 8 years, 2 months ago by rwwood.
September 28, 2016 at 2:55 pm #692697Hi,
just include those folders inside your child theme directory.
Best regards,
Andy -
AuthorPosts
- You must be logged in to reply to this topic.