Home › Forums › Calendar Products › Events Calendar PRO › duplicate page titles showing
- This topic has 3 replies, 2 voices, and was last updated 8 years, 5 months ago by George.
-
AuthorPosts
-
November 23, 2015 at 11:11 am #1029772Brett JohnsonParticipant
In the process of updating the events calendar/PRO plugin. On my machine (localhost) I see DUPLICATE page titles (wp_title). Any ideas why this can be occurring? What I see now as page title, EXAMPLE: Upcoming Events | Events | Torpedo Factory Art Center. What it should be: Upcoming Events | Torpedo Factory Art Center
Please see screenshot at:
Thanks
November 23, 2015 at 11:48 am #1029797GeorgeParticipantHey @Alyssa,
Thanks for reaching out!
I have some good and bad news here.
The bad news is that I unfortunately do not know why this is happening – I can’t quite recreate this exact issue on my local testing site. Your theme’s own wp_title() filters might be the problem here.
However, the good news is that you can just override this manually – it will only affect the title on The Events Calendar pages too!
To override this, you would add code like the following to your theme’s functions.php file:
add_filter( 'tribe_events_title_tag', 'tribe_1029772', 10, 3 );function tribe_1029772( $new_title, $the_title, $sep ) {
return 'Upcoming Events | Torpedo Factory Art Center';
}
If you want to get more detailed with that, you can combine the above code snippet with the Conditional tags listed here, for example → https://gist.github.com/jo-snips/2415009
So, for example, if you want the title to be “Upcoming Events This Month” on month view, but “Upcoming Events This Week” on week view, something like this should work well:
add_filter( 'tribe_events_title_tag', 'tribe_1029772', 10, 3 );function tribe_1029772( $new_title, $the_title, $sep ) {
if ( tribe_is_month() && ! is_tax() ) {
$new_title = 'Upcoming Events This Month | Torpedo Factory Art Center';
}if ( tribe_is_week() && !is_tax() ) {
$new_title = 'Upcoming Events This Week | Torpedo Factory Art Center';
}return $new_title;
}
I hope this helps!
Cheers,
GeorgeNovember 25, 2015 at 9:49 am #1030887Brett JohnsonParticipantThank you! That was very helpful and you were correct my Theme was also manipulating wp_title(). So I hooked on to your filters and changed the title accordingly for Events only.
November 29, 2015 at 3:51 pm #1032228GeorgeParticipantAwesome – glad to hear this snippet helped. Be sure to backup any custom code like this, or bookmark this thread for future reference or something like that (just so that it’s easy to replace the code in the event that, if you auto-update your theme, this code gets overwritten).
Cheers!
George -
AuthorPosts
- The topic ‘duplicate page titles showing’ is closed to new replies.