最后,这就是对我有用的功能:
add_filter(\'the_content\', \'first_line_bold\');
function first_line_bold($content)
{
if (!is_page()) {
$pattern = "/<p.*?>([^`]*?)<\\/p>/";
$match = "<span style=\\"font-weight:bold;font-size:16px;\\">$1</span>";
$content = preg_replace($pattern, $match, $content, 1);
return $content;
}
}