Archived topic
Please add support to customise register_sidebar element type
3 replies · Started by Mark on September 12, 2019
Hi,
I love the theme, I am using it on all my sites going forward where I can. its light but also customisable and gives me a break from underscores.
for SEO purposes it would be fantastic to add an option to customise the widget element type from h2 to either h3/h4/p/span etc?
I have hardcoded it for current use but will forget when I update in the future.. :)
/inc/general.php
foreach ( $widgets as $id => $name ) {
register_sidebar( array(
'name' => $name,
'id' => $id,
'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
'after_widget' => '</aside>',
'before_title' => apply_filters( 'generate_start_widget_title', '<h2 class="widget-title">' ),
'after_title' => apply_filters( 'generate_end_widget_title', '</h2>' ),
) );
}
Hi there,
if you're looking to change the tag on the widget title then you can use the filter.
This topic provides an example where the user wanted to inject a span tag within the H2:
https://generatepress.com/forums/topic/widget-title-span/#post-976895
Let me know if understood correctly.
Perfect, of course I should have known! thanks alot.
Almost everything in GP has a filter - its Tom's obsession :)
Glad to be of help.