Skip to content

Instantly share code, notes, and snippets.

@anythinggraphic
Last active August 31, 2017 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anythinggraphic/d9a44661821031c224a1f1737e6e7844 to your computer and use it in GitHub Desktop.
Save anythinggraphic/d9a44661821031c224a1f1737e6e7844 to your computer and use it in GitHub Desktop.
Add custom Twitter Social Share descriptions for Yoast SEO for Archive pages
<?php
/* @link https://anythinggraphic.net/yoast-seo-add-custom-social-share-images-for-archive-category-pages-in-wordpress
/* Add custom Twitter Social Share descriptions for Yoast SEO for Archive pages
----------------------------------------------------------------------------------------*/
add_filter( 'wpseo_metadesc', 'ag_yoast_seo_tw_share_descriptions', 10, 1 );
function ag_yoast_seo_tw_share_descriptions( $desc ) {
if( is_post_type_archive( 'portfolio' ) ) {
$desc = 'Design and development projects by Anything Graphic.';
}
if( is_category( 'categoryname' ) ) {
$desc = 'Design and development projects by Anything Graphic.';
}
return $desc;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment