有一个自定义分类法(STORE),我只想将此代码添加到一个分类法中
<link rel="alternate" hreflang="fr" href="http://www.domain.com/fr" />
我应该使用什么代码?有一个自定义分类法(STORE),我只想将此代码添加到一个分类法中
<link rel="alternate" hreflang="fr" href="http://www.domain.com/fr" />
我应该使用什么代码?在这种情况下,您只需要在wp_head
行动将以下内容放置在functions.php
将解决问题:
add_action( \'wp_head\', \'q166556_taxonomy_head\' );
function q166556_taxonomy_head(){
// Conditional for Taxonomy archives and posts that have any term from the taxonomy `store`
if ( ! has_term( \'\', \'store\' ) && ! is_tax( \'store\' ) ){
return;
}
echo \'<link rel="alternate" hreflang="fr" href="http://www.domain.com/fr" />\';
}