Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1465340

    I found below code to place in the functions.php file to change h2 tags in the Fullwidth easy slider:to h1. However, now I have several h1 tags, which I don’t want either. I’m looking for a way to set the first titel to h1, the others to h2. how do I do this?

    *Change h2 tag full width slider to h1
    */
    function replace_tags_with_tags(){
    ?>
    <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('.slideshow_caption h2.avia-caption-title', '<h1></h1>');
        
      }(jQuery)); 
    </script>
    <?php
    }
    add_action('wp_footer', 'replace_tags_with_tags');
    #1465352

    Hey Peter,
    To have only the first slide title changed to H1 try this instead:

    function replace_first_slide_title_tag(){
    ?>
    <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('.slide-1 .slideshow_caption h2.avia-caption-title', '<h1></h1>');
        
      }(jQuery)); 
    </script>
    <?php
    }
    add_action('wp_footer', 'replace_first_slide_title_tag');

    Best regards,
    Mike

    #1465358

    you my kind Sir deserve a statue! works like a charm. many thanks!

    #1465359

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Fullwidth easy slider: setting first titel to H1, others to H2.’ is closed to new replies.