Change H3 element in Widget Title

Hi, I want to change the H3 element to p in my site.

<h3 class="widget-title">

Is there a way to add a filter or any code that I can change it to “p”?

thanks in advance. :smile:

I have this jQuery code in my footer:

<script>
jQuery( document ).ready(function($) {
(function($) {
    $.fn.changeElementType = function(newType) {
        var attrs = {};

        $.each(this[0].attributes, function(idx, attr) {
            attrs[attr.nodeName] = attr.nodeValue;
        });

        this.replaceWith(function() {
            return $("<" + newType + "/>", attrs).append($(this).contents());
        });
    }
})(jQuery);
$("h2.entry-title").changeElementType("p");
});
</script>

The H2 title was able to change in “p” element but when I try to change the H3 like this:

<script>
jQuery( document ).ready(function($) {
(function($) {
    $.fn.changeElementType = function(newType) {
        var attrs = {};

        $.each(this[0].attributes, function(idx, attr) {
            attrs[attr.nodeName] = attr.nodeValue;
        });

        this.replaceWith(function() {
            return $("<" + newType + "/>", attrs).append($(this).contents());
        });
    }
})(jQuery);
$("h2.entry-title").changeElementType("p");
$("h3.widget-title").changeElementType("p");
});
</script>

The H2 element still appears as “p” but the H3 doesn’t change at all.

May I ask why do you ever want to do this?

It’s part of the instructions our client requested. I know where is it located in the Headway theme part but i don’t want to modify the block functions if there is a tricky way to do this.

I’m wondering why your client thinks they need to do this as well, seems like it’s just creating an accessibility problem.

Why not just use CSS to style the text?

I just told them it could break the core function of the theme. Im now good. Thanks so much for your advice. :smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.