Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1485951

    Hello, I noticed title posts in grid view are set to h3.

    I would like them to have the h2 tag. I couldn’t find any options. Is it possible to change it?

    Thank you.

    #1485981

    Hey faroestudio,
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function change_posts_titles_from_h3_to_h2_in_grid_view() { ?>
      <script>
    (function($) {
      $(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('.slide-entry-wrap h3.slide-entry-title.entry-title ', '<h2></h2>');
      });
    }(jQuery));
    </script>
      <?php
    }
    add_action( 'wp_footer', 'change_posts_titles_from_h3_to_h2_in_grid_view', 99 );

    If you are not using a child theme you could use the WP Code plugin then add a new snippet, in the top right corner use the PHP snippet as the code type:
    use wpcode php snippet and activate
    and ensure that it is activated, then add the above code and save.

    Best regards,
    Mike

    #1486039
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.