Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1468770

    I’d like to change the captions (of some) images to H3, how can i do that? (not just in style, but to make them actual H3)

    #1468856

    Hey Peter,
    PLease include a link to your page as there are a few different solutions depending on the element used.

    Best regards,
    Mike

    #1469437

    Hi Mike, its for https://fysiobreda.thedigitalmanager.nl/
    there is the section on the homepage with ‘hier heb ik pijn’ with images of ‘rug’, ‘schoulder’ & ‘elleboog’ under it. I’d like the caption of those images to become H3.

    #1469452

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

    function custom_h3_script() { ?>
      <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('.av-image-caption-overlay-center p', '<h3></h3>');
      });
    }(jQuery)); 
    </script>
      <?php
    }
    add_action( 'wp_footer', 'custom_h3_script', 99 );

    Best regards,
    Mike

    #1471951

    Hi @Mike. that doesnt seem to work. images are still h1. is there another way to change this?

    #1471952

    Hi,
    The captions of ‘rug’, ‘schoulder’ & ‘elleboog’ were a a paragraph tag and not H1, I added the code for you and now they are a H3
    Enfold Support 6549
    you can use css to change the size and color.

    Best regards,
    Mike

    #1471955

    @mike ! awesome! case closed:) many thanks

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Change caption of image to H3’ is closed to new replies.