Tagged: Fullwidth easy slide, header tags
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');
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
you my kind Sir deserve a statue! works like a charm. many thanks!
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