Skip to content

Instantly share code, notes, and snippets.

@noellesteegs
Last active September 15, 2023 10:48
Show Gist options
  • Save noellesteegs/8b1678d0e4b8505771239a7dc67a9b33 to your computer and use it in GitHub Desktop.
Save noellesteegs/8b1678d0e4b8505771239a7dc67a9b33 to your computer and use it in GitHub Desktop.
Sets meta descriptions for The Events Calendar views through Yoast SEO
<?php
function na_filter_events_desc( $description ) {
if( tribe_context()->get( 'view_request' ) === 'default' ) {
$description = 'Your description here.';
} elseif( tribe_context()->get( 'view_request' ) === 'list' ) {
$description = 'Your description here.';
} elseif( tribe_context()->get( 'view_request' ) === 'day' ) {
$description = 'Your description here.';
} elseif( tribe_context()->get( 'view_request' ) === 'map' ) {
$description = 'Your description here.';
}
return $description;
}
add_filter( 'wpseo_metadesc', 'na_filter_events_desc' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment