Site logo

Archived topic

Filter plugin doesnt work

5 replies · Started by Nina on August 31, 2020

Viewing posts 1–6 of 6

I want to change the widget title from h2 to h4. I've seen the filter code I need to use, and read I should do this either by using a code snippet or by making a plugin. I then made a plugin, inserted the code, and nothing happens? Do I need to link my plugin to the theme somehow?

Hi there,

Using the code snippets plugin should be the easier way.

Can you give that a shot first?

Let me know :)

I just tried it. It didn't work. When inspecting the site the widget title is still h2.

The code i use is:

add_filter( 'generate_start_widget_title', function() {
    return '<h4 class="widget-title">';
} );

add_filter( 'generate_end_widget_title', function() {
    return '</h4>';
} );

I found this in another support thread. Is there a problem with the code?

That code should work.

Did you clear your caching plugins?

I just double checked clearing my cache. Nothing changed. Is there somewhere special I should put the shortcode I got from the code snippet plugin?

Is there somewhere special I should put the shortcode I got from the code snippet plugin?

There shouldn't be any shortcodes.

All you should need to do is to install and activate Code Snippets, create a new snippet, copy and paste the code above then save and publish to run in the entire site.

This archived topic is closed to new replies.