我正在努力改进本教程script 包括switch
在第一个if
指定自定义的条件priority
仅限于某些帖子或页面。
所以我想告诉Yoastif some pages have certain id
the priority
have to change, 但我的脚本将0.5值分配给所有页面。
有什么帮助吗?
add_filter( \'wpseo_xml_sitemap_post_priority\', \'my_custom_post_xml_priority\', 10, 3 );
function my_custom_post_xml_priority( $return, $type, $post) {
if($type == \'page\') {
switch ($post) {
case \'8\':
case \'395\':
case \'342\':
$return = 0.9;
case \'5\':
$return = 1.00;
case \'620\':
case \'703\':
case \'603\':
case \'688\':
case \'695\':
case \'614\':
case \'684\':
case \'639\':
case \'628\':
case \'539\':
case \'542\':
case \'521\':
case \'509\':
case \'517\':
case \'528\':
case \'533\':
case \'536\':
case \'548\':
case \'545\':
case \'525\':
case \'551\':
$return = 0.7;
break;
default:
$return = 0.5;
break;
}
}
elseif ($type == \'post\') {
$return = 0.8;
}
return $return;
}