Home › Forums › Calendar Products › Events Calendar PRO › Yoast & ECP
- This topic has 14 replies, 4 voices, and was last updated 8 years, 8 months ago by Support Droid.
-
AuthorPosts
-
September 10, 2012 at 4:56 am #24742Jonathan MartinParticipant
Hi Guys,
We’re having a similar problem to a number of other posters on the forum with the page titles. At the moment we have no page title set at all for any of the events pages (we only use upcoming, past & calendar).I saw this and tried the same fix: https://theeventscalendar.com/support/forums/topic/editing-page-titles-when-using-wordpress-seo-plugin/
It’s not working for me though. The filter is definitely being called as I can insert a die; statement and the script dies as expected. Here’s what I’m using:
function eddytm_modify_past_events_title( $title, $separator ) {
$new_title = ‘Upcoming Events’;
return $new_title;
}
add_filter(‘tribe_past_events_title’, ‘eddytm_modify_past_events_title’, 10, 3);function eddytm_modify_upcoming_events_title( $title, $separator ) {
$new_title = ‘Some Events’;
return $new_title;
}
add_filter(‘tribe_upcoming_events_title’, ‘eddytm_modify_upcoming_events_title’, 10, 3);Any ideas?
September 10, 2012 at 6:17 pm #24788JonahParticipantHi Jon,
The first thing you should check is your code syntax. Your fancy single quotes above will not work – you need to use regular single quotes. I corrected this and popped the code in my functions.php file and it works for me. And just to confirm you are trying to change the HTML title tag titles and not the page title that appears on the page at the top of events correct?
Please verify your code and confirm what you’re trying to change.
Thanks,
JonahSeptember 11, 2012 at 1:12 am #24797Jonathan MartinParticipantHI Jonah,
Thanks for getting back to me. The fancy quotes are only an issue because I’ve copied from my development environment into the comment reply box here. They’re fine in my source but to make sure we’re totally clear, I’ve put them here: http://pastebin.com/P66sGWLcAnd to confirm: yes, I’m trying to change the tag.
Cheers.
September 11, 2012 at 8:07 am #24806JonahParticipantHi Jon,
That code should work then. Maybe it’s your theme. Have you tried reverting to Twenty Eleven to see if the code works there?
Thanks,
JonahSeptember 11, 2012 at 9:57 am #24816Jonathan MartinParticipantI hadn’t, but I’ve just tried it and it made no difference I’m afraid.
September 11, 2012 at 10:26 am #24820JonahParticipantHi Jon,
Ok, can you send us a copy of your theme? Please email to pro [at] tri [dot] be and reference this thread and attention it to me. I’ll take a look and see what else I can find.
Thanks,
JonahSeptember 11, 2012 at 12:31 pm #24826Jonathan MartinParticipantAll done. Thanks Jonah!
September 12, 2012 at 4:03 pm #24955JonahParticipantHi Jon,
I think I figured it out. If you are using WP SEO, you will not be able to use our filters to modify the titles, you need to use the WP SEO filter for ‘wpseo_title’ instead. Here is an example: https://gist.github.com/3710617
You can combine this with the conditional wrappers here to modify the titles for all the event plugin related pages: https://gist.github.com/2415009
Oh, and since your jagermaster themes header.php calls the wp_title plus the bloginfo(‘name’), you’ll want to remove the bloginfo part because ‘wpseo_title’ only filters wp_title.
I hope that helps but let me know if you need anything else!
Cheers,
JonahSeptember 13, 2012 at 1:44 am #24974Jonathan MartinParticipantHey Jonah,
That worked perfectly! Interestingly, and I assume it’s because of Yoast SEO, I still needed to call get_bloginfo(‘name’) in the filters, even though it’s still being called in header.php.
Here’s the code I used in the end: https://gist.github.com/3712948
Note for anyone else reading, there’s lots of redundancy in this code as I haven’t fixed the page titles yet, but if you are only using a couple of different page titles then you can cut down the number of elseif conditions.
The only thing I haven’t been able to do with the conditional wrappers you provided was past events. I’m not actually too worried about that in this case, but it’d be useful to understand for the future.
Thanks for all your help!
September 13, 2012 at 7:48 am #24985JonahParticipantHey Jon,
The code looks good and I’m glad you worked this out. To check for whether you are viewing past events or not you should be able to use:
tribe_is_past();
Cheers,
JonahSeptember 13, 2012 at 9:34 am #24998Jonathan MartinParticipantThat worked perfectly. There is one issue with my code and that’s that the else statement sets ALL titles except for the ECP titles to be Events | Blogname. So I’ve removed that and it’s working fine.
Thanks for all your help.
September 26, 2012 at 4:15 am #25736QParticipanthere’s my take on TEC & WPSEO titles – I’ve added a custom taxonomy – tags – to tribe_events, so needed to separate that out to – http://pastebin.com/VVXMVn7M
September 26, 2012 at 9:08 am #25750JonahParticipantThat’s awesome Ray! Thanks for the contribution!
– Jonah
September 26, 2012 at 9:12 am #25751QParticipantwell, it might have one or two small errors.. I’m still testing it – I also use a simple get event cat function ( http://pastebin.com/bzaSe984 ) which I was using to get the category – perhaps better to be using your own class – which I tried in the SEO title function…
July 7, 2015 at 6:26 am #977848Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Yoast & ECP’ is closed to new replies.