对于页面标题,请编辑页面。php并替换_title();使用:
$words = explode(\' \', the_title(\'\', \'\', false));
$words[0] = \'<span>\'.$words[0].\'</span>\';
$title = implode(\' \', $words);
echo $title;
或者对于一般的所有标题(这将在任何标题的第一个单词周围添加跨度,例如文章标题、页面标题,并且\\u标题也用于页面列表中)-将类似的内容添加到函数中。主题的php:
add_filter(\'the_title\', \'span_first_word\');
function span_first_word($title) {
$words = explode(\' \', $title);
$words[0] = \'<span>\'.$words[0].\'</span>\';
$title = implode(\' \', $words);
return $title;
}