Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1451619

    hello, I would like to customize the footer and more particularly the widgets which take the h3 attribute as a title to use a title without an Hx attribute which will be personalized by CSS via .widgettitle

    is it possible ?

    #1451625

    Hey Webmaster,
    To change all of the widget titles from H3 to “p” add this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function custom_widgettitle_script() { ?>
      <script>
    (function($) {
        function replaceElementTag(targetSelector, newTagString) {
          $(targetSelector).each(function(){
            var newElem = $(newTagString, {html: $(this).html()});
            $.each(this.attributes, function() {
              newElem.attr(this.name, this.value);
            });
            $(this).replaceWith(newElem);
          });
        }
        replaceElementTag('h3.widgettitle', '<p></p>');
    }(jQuery)); 
    </script>
      <?php
    }
    add_action( 'wp_footer', 'custom_widgettitle_script', 99 );

    Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.

    Best regards,
    Mike

    #1451627

    Perfect !

    Thank you for your fast and quality support

    Best regards,

    #1451629
    #1451635

    Hi,

    Thanks for the update. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1451639
    This reply has been marked as private.
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘remove the h3 attribute for widget titles’ is closed to new replies.