Home › Forums › Calendar Products › Events Calendar PRO › get the Events landing page title to change to Events – not latest event
- This topic has 9 replies, 2 voices, and was last updated 10 years, 6 months ago by
George.
-
AuthorPosts
-
October 16, 2015 at 3:08 am #1015185
David
ParticipantHi Guys,
I need the Events landing page title to be “Events”, currently it uses the title of the next event which makes no sense to me.
I’ve tried this code from other sort of similar posts: https://gist.github.com/jesseeproductions/f4937c82325ab152cb24 not joy 🙁
I also need the Breadcrumb to work, currently it’s just Home, or Home > Event Title but I need:
Home > Events > Name of Event
October 16, 2015 at 3:32 am #1015193David
ParticipantThis reply is private.
October 16, 2015 at 7:48 am #1015295George
ParticipantHey @David,
Sorry to hear about these issues – Brian’s script indeed won’t work here, because that script addresses a problem from the Yoast SEO plugin. Your issue here, meanwhile, is related to/caused by your theme, as evidenced in the header tag’s HTML:

We don’t officially offer any theme support and such, but if you can send a .zip of your theme over to use by uploading it to http://ge.tt and then sharing the link there, I will download the theme and take a look at what is generating this. I should be able to recommend some code to fix this.
A simple solution would be to just use JavaScript to overwrite this from the outset on page load. You can do that by adding this code snippet to your theme or child theme’s functions.php file:
if ( function_exists( 'tribe_get_events' ) ) { /** * Force the page title to say "Events". * @link http://theeventscalendar.com/?p=1015185 */ function tribe_support_1015185() { ?><script> var title_replace = document.querySelector( '.uk-article-title' ); title_replace.innerText = title_replace.textContent = 'Events'; </script><?php } add_action( 'wp_footer', 'tribe_support_1015185' ); }-
This reply was modified 10 years, 6 months ago by
George.
October 16, 2015 at 8:19 am #1015308David
ParticipantThanks George, the js fix sort of works but it replaces all page titles.
This is the piece of code…
<?php if ($this['config']->get('page_title', true)) : ?> <div class="uk-container uk-container-center"> <h1 class="uk-article-title"><?php the_title(); ?></h1> </div> <?php endif; ?>I’ve uploaded the zip here: http://ge.tt/2kSIH9Q2/v/0?c
The file for this is yoo_katana_wp/styles/imro-one/theme.php
October 16, 2015 at 1:48 pm #1015433George
ParticipantHey David,
Thanks for this! I think that if you add code like the following to your theme’s functions.php file, you’ll be good to go:
if ( function_exists( 'tribe_get_events' ) ) {
/**
* Force the page title to say "Events", for real.
* @link http://theeventscalendar.com/?p=1015185
*/
function tribe_support_1015185_title( $title, $post_id ) {if ( tribe_is_event( $post_id ) && is_single() )
$title = 'Events';return $title;
}add_filter( 'the_title', 'tribe_support_1015185_title', 10, 2 );
}
I hope this helps!
George
October 19, 2015 at 2:38 am #1015730David
ParticipantThanks George, this actually works the opposite of what we need.
The All Events page has the event title which the single event page is titled Events.
Can you tell me how to switch them around?
David
October 20, 2015 at 9:14 am #1016273George
ParticipantAH, sorry about that David! Dumb mistake on my part. Unfortunately I don’t know your theme well enough to customize the proper title you’re referring to; I’d recommend keeping the somewhat-okay JavaScript version for now, as a temporary fix, while you contact your theme developer for help with doing it “properly” via php…
One thing you can try is, instead of using my original function, just replace the existing code within the theme to become this:
<?php if ($this['config']->get('page_title', true)) : ?>
<div class="uk-container uk-container-center">
<h1 class="uk-article-title"><?php if ( tribe_is_event( get_the_ID() ) ) ? 'Events' : the_title(); ?></h1>
</div>
<?php endif; ?>
Thanks for your patience here David; I hope my code here helps, and if not, then I hope my suggestion with regards to your theme developer help instead.
Let me know if either is the case! 🙂
Sincerely,
GeorgeOctober 20, 2015 at 9:17 am #1016275George
ParticipantAH, sorry about that David! Dumb mistake on my part. Unfortunately I don’t know your theme well enough to customize the proper title you’re referring to; I’d recommend keeping the somewhat-okay JavaScript version for now, as a temporary fix, while you contact your theme developer for help with doing it “properly” via php…
One thing you can try is, instead of using my original function, just replace the existing code within the theme to become this:
<?php if ($this['config']->get('page_title', true)) : ?>
<div class="uk-container uk-container-center">
<h1 class="uk-article-title"><?php echo tribe_is_event( get_the_ID() ) ? 'Events' : the_title(); ?></h1>
</div>
<?php endif; ?>
Thanks for your patience here David; I hope my code here helps, and if not, then I hope my suggestion with regards to your theme developer help instead.
Let me know if either is the case! 🙂
Sincerely,
GeorgeOctober 20, 2015 at 9:34 am #1016284David
ParticipantThanks George, unfortunately that doesn’t make a difference for the good, for the time being I’m switching to the first option which isn’t perfect but covers most of the titles.
Did you have any suggestions for the Breadcrumb issues so that:
Home > Event Titleis
Home > Events > Event Title?
David
October 21, 2015 at 9:59 am #1016624George
ParticipantSorry about the lack of success with the secondary methods David – thanks for trying out my suggestions!
When it comes to your breadcrumbs, these are unfortunately a bit more complicated and theme-specific so you’d unfortunately have to do some more extensive customization than what can be assisted with here on the forums. I’d recommend contacting your theme developer for help with that specifically if possible!
Best of luck with your site 🙂
George
-
This reply was modified 10 years, 6 months ago by
-
AuthorPosts
- The topic ‘get the Events landing page title to change to Events – not latest event’ is closed to new replies.
