2017-05-01 12 views
1

Yoast SEO(wpseo plugin)カテゴリの説明テンプレートをアーカイブテンプレート内に表示する必要があります。デフォルトのYoast SEOカテゴリの説明を表示

私は私のアーカイブテンプレートでこれを表示する必要があります。

My site %%term_title%%. In category %%term_title%%. 

は達成することが可能で、このですか?もしそうなら、どうですか?

答えて

0

OK!私は自分の問題を完全に解決する一つの答えを見つけました。here

、カテゴリ、分類のアーカイブ、ページのためWPSEOのタイトルと説明を取得します投稿Chuck Reynoldsから

// access wpseo_frontend class and get the seo title and seo description for output on archive pages 
if (class_exists('WPSEO_Frontend')) { 
    $wpseo_object = WPSEO_Frontend::get_instance(); 
    $headline = $wpseo_object->title(false); 
    $intro_text = $wpseo_object->metadesc(false); 
} 
$headline = sanitize_text_field($headline); 
$intro_text = sanitize_text_field($intro_text); 
// these should work if not archives 
# $headline = get_post_meta($post->ID, '_yoast_wpseo_title', true); 
# $intro_text = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true); 

感謝を:

これは、コードです!

関連する問題