Last active
November 9, 2021 20:08
-
-
Save oldlastman/e7eab1f1ca186f90ecc7bc672a251d2f to your computer and use it in GitHub Desktop.
yoast seo description shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*si se va a usar como plugin en solitario añadir la información de plugin*/ | |
/* utilizar la meta description para mostrarlo en web*/ | |
function att_yoast_metadescription_sc() { | |
$metadescription = get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true); | |
// en caso de no exister descripción devolver mensaje en blanco | |
if (!$metadescription) { | |
$metadescription = ''; | |
} | |
return $metadescription; | |
} | |
add_shortcode( 'att_yoast_metadescription', 'att_yoast_metadescription_sc' ); | |
/*quitar último elemento de breadcrum si es un paginado*/ | |
function att_remove_yoast_breadcrumb_link($link_output , $link) | |
{ | |
$text_array = explode(' ', $link['text']); | |
if ( ( ($text_array[0]=='Página')||($text_array[0]=='Page')) && ( is_numeric($text_array[1]) ) ) { | |
$link_output = ''; | |
} | |
return $link_output; | |
} | |
add_filter('wpseo_breadcrumb_single_link' ,'att_remove_yoast_breadcrumb_link', 10 ,2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment