Home › Forums › Calendar Products › Events Calendar PRO › Another YOAST related issue
- This topic has 6 replies, 2 voices, and was last updated 8 years, 4 months ago by
Joel Moir.
-
AuthorPosts
-
November 14, 2017 at 8:10 pm #1383197
Joel Moir
ParticipantHi,
I’ve spent a good amount of time trying to solve this myself, trawling through forums and google searches, but still can’t fully solve my problem.
Like many others who have had Yoast related issues, I’ve been trying to nail the “Archive” title when on the main events page of our site. http://www.stringfamily.com.au/itinerary
I’ve reviewed the posts about adding custom code to functions.php and have done this via “My Custom Functions” WordPress plugin. (I had dramas creating a child theme… site wasn’t displaying properly and I just don’t have the time to troubleshoot it.) It works very well to the extend that the code I’ve plugged in doesn’t break the site, and in fact does change the title. But now the title is not displayed at all, and just contains ” | The String Family” instead of ”
I’ve used information from these links:
https://theeventscalendar.com/knowledgebase/yoast-wordpress-seo-plugin-conflicts/
https://theeventscalendar.com/knowledgebase/titles-in-yoast-seo/The code that I’m using:
/* Plugin Name: The Events Calendar Remove Events Archive from Yoast Page Title Plugin URI: https://gist.github.com/geoffgraham/041c048aca979de714273314ae039ce7 Description: The Events Calendar - Yoast SEO - Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,) */ add_action( 'pre_get_posts', 'tribe_remove_wpseo_title_rewrite', 20 ); function tribe_remove_wpseo_title_rewrite() { if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) { if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) { $wpseo_front = WPSEO_Frontend::get_instance(); remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 ); remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 ); } } elseif ( class_exists( 'Tribe__Events__Main' ) && !class_exists( 'Tribe__Events__Pro__Main' ) ) { if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) { $wpseo_front = WPSEO_Frontend::get_instance(); remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 ); remove_filter( 'pre_get_document_title', array( $wpseo_front, 'title' ), 15 ); } } }; /* add_filter( 'tribe_events_title_tag', function( $default_title ) { if ( ! tribe_is_month() ) { return $default_title; } return 'MONTH VIEW CUSTOM TITLE!'; } ); */The bottom section of code there, currently commented out, I found on another post in your knowledge base, but it makes no difference to what is displayed in the title.
Any help would be appreciated.
Regards
Joel
November 14, 2017 at 8:15 pm #1383203Joel Moir
ParticipantThat code didn’t come out properly… Here it is again.
/*
Plugin Name: The Events Calendar Remove Events Archive from Yoast Page Title
Plugin URI: https://gist.github.com/geoffgraham/041c048aca979de714273314ae039ce7
Description: The Events Calendar – Yoast SEO – Prevent Yoast from changing Event Title Tags for Event Views (Month, List, Etc,)
*/
add_action( ‘pre_get_posts’, ‘tribe_remove_wpseo_title_rewrite’, 20 );
function tribe_remove_wpseo_title_rewrite() {
if ( class_exists( ‘Tribe__Events__Main’ ) && class_exists( ‘Tribe__Events__Pro__Main’ ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) {
$wpseo_front = WPSEO_Frontend::get_instance();
remove_filter( ‘wp_title’, array( $wpseo_front, ‘title’ ), 15 );
remove_filter( ‘pre_get_document_title’, array( $wpseo_front, ‘title’ ), 15 );
}
} elseif ( class_exists( ‘Tribe__Events__Main’ ) && !class_exists( ‘Tribe__Events__Pro__Main’ ) ) {
if( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {
$wpseo_front = WPSEO_Frontend::get_instance();
remove_filter( ‘wp_title’, array( $wpseo_front, ‘title’ ), 15 );
remove_filter( ‘pre_get_document_title’, array( $wpseo_front, ‘title’ ), 15 );
}
}
};add_filter( ‘tribe_events_title_tag’, function( $default_title ) {
if ( ! tribe_is_month() ) {
return $default_title;
}return ‘MONTH VIEW CUSTOM TITLE!’;
} );November 16, 2017 at 6:20 am #1384497Victor
MemberHi Joel!
Thanks for getting in touch with us! Let me help you with this topic.
I tried using the code you shared and it works for me. Did it stop working all of a sudden or do you recall doing a certain action in your site before it stopped working?
If you are using the My Custom Functions plugin to place the code, I’d suggest you try placing it in your active theme’s functions.php file to see if any difference.
If it still no difference, then you should try switching to a default theme and then place the code in that theme’s functions.php file to see if it works.
If it doesn’t, please proceed with the testing for conflicts guide > https://theeventscalendar.com/knowledgebase/testing-for-conflicts/ to make sure we are not dealing with a plugin conflict.
I suggest you setup a dev/staging site so you can make all these tests without disrupting the live site. We also encourage to make a full <u>backup</u> of your site, both database and files so in case something goes wrong you can always restore your site.
Let me know how that goes.
Thanks,
VictorNovember 16, 2017 at 1:14 pm #1385069Joel Moir
ParticipantHi Victor,
If I switch to the 2017 theme, the php change works.
In terms of it stopping all of a sudden, it’s only something that I’ve implemented a few days ago, and it didn’t work – the title was blank before the | separator.
It must be a divi issue. I have to work out if I have the energy to begin the troubleshooting process, as I’m a recovering IT Consultant who burnt out after nearly 20 years of being in the industry. As a musician our website is super important, but have to decide whether that particular issue is worth a couple of days of work.
I’ll most likely take the plunge, I pretty much can’t help it, but at least now I know that with another theme it works ok, and it gives me somewhere to start.
If you have any suggestions on the divi theme specifically, I’ll happily take them on board, otherwise I’ll just update you as I go with my troubleshooting.
Thanks again for your help
November 20, 2017 at 4:12 am #1387028Victor
MemberHi Joel!
Thanks for following up with this and for testing that out.
I totally understand your position, so now we know it’s most likely a conflict with Divi, let me try to help you with the troubleshooting.
I have just tried to reproduce the issue using Divi, but failed to do so. Could you please let me know which version of Divi theme you are currently using?
Also, this might be due to specific Divi settings, so if you could export your Divi Theme Options and share those with us (in a private reply if you’d like) so I can try to reproduce the issue?
As Divi theme is very used across our users, we’ve built an extension where we aim to address conflicts with Divi and other Elegant Themes > https://theeventscalendar.com/extensions/elegant-themes-divi-theme-compatibility/
While I don’t think your particular issue will be resolved with the extension, I suggest you take a look at it and give it a try.
Please let me know how that goes and if you have any questions as we are here to help as much possible.
Best,
VictorDecember 12, 2017 at 8:35 am #1403648Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Another YOAST related issue’ is closed to new replies.
