Tagged: Event calendar
-
AuthorPosts
-
January 3, 2020 at 11:24 am #1169271
Howdy!
I use The Event Calendar. The title of an event single page is set to h2 by default. I would like to change this to h1.
In my search for a solution, I found this thread.So far, this solution works, but:
1. the solution sets all h2 on the event page to h1. I’d like only to change the title
2. I cannot find a way to apply this solution to a child-heme.Do you have any ideas?
regards
joerg- This topic was modified 4 years, 11 months ago by netgo2017.
January 3, 2020 at 6:22 pm #1170076Hey netgo2017,
Did you try the single-event.php editing or adding the JavaScript code to the functions.php?
Best regards,
VictoriaJanuary 6, 2020 at 9:06 am #1170640Hi Victoria!
single-event.php:
Works great, but I can’t find a way to add this in my child-theme.functions.php:
Works in child-theme, but this method sets all h2 on the event page to h1, not only the title.regards
JörgJanuary 7, 2020 at 2:36 am #1170882Hi,
Thank you for the update.
Could you give us a link to the actual event page? Perhaps we can use a different selector in the custom replaceElementTag function to exclude the other h2 in the site and only change the main title.
Example:
replaceElementTag('.tribe-events-single-event-title', '<h1></h1>');
Best regards,
IsmaelJanuary 7, 2020 at 8:29 am #1170952Hi!
Yes, of course. This is an example.
Thanks a lot and regards
JörgJanuary 7, 2020 at 11:50 am #1171007Hi,
Are you using the second script with a function called replaceElementTag from the previous thread? Try to replace this line:
replaceElementTag('.av-single-event-content h2', '<h1></h1>'); // each replacement separated by semi-colon
with:
replaceElementTag('.tribe-events-single-event-title', '<h1></h1>');
Best regards,
IsmaelJanuary 7, 2020 at 4:53 pm #1171093Hi Ismael!
Yes, that works. Thank you very very much!
@all: here my full code:
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('.tribe-events-single-event-title', '<h1></h1>'); // each replacement separated by semi-colon }(jQuery)); </script> <?php } add_action('wp_footer', 'replace_tags_with_tags');
Best regards
JörgJanuary 7, 2020 at 4:55 pm #1171095 -
AuthorPosts
- The topic ‘enfold with event calendar: change event title from h2 to h1 -SOLVED-’ is closed to new replies.