格式是否始终如您所述?一、 我们可以用“x”作为分隔符来拆分标题吗?如果是这样的话,类似这样的方法会奏效:
add_filter( \'the_title\', \'wp123_custom_title_format\', 10, 2 );
function wp123_custom_title_format( $title ) {
// if you only want to modify certain posts you can do a check here
// use \'x\' as your delimiter
$pieces = explode( "x", $title, 2 );
if ( 2 == count( $pieces ) {
$title = \'<span class="boldtext">\' . $pieces[0] . \' x </span>\';
$title .= \'<span class="normaltext">\' . $pieces[1] . \'</span>\';
}
return $title;
}