我正在尝试将架构标记添加到搜索结果页,并尝试使用以下代码:-
function body_schema()
{
$schema = \'http://schema.org/\';
if(is_search())
{
$type = "SearchResultsPage";
} else {
$type = \'Blog\';
}
echo \'itemscope itemtype="\' . $schema . $type . \'"\';
}
一旦我把它传给标题上的body标签,它似乎就不起作用了。我试着到处寻找答案,但找不到其他解决方案。