Set post title font size automatically according to number of words in post title
You need to target the the_title filter. In that filter we can manipulate the output string as we need. add_filter(‘the_title’, ‘bt_the_title’); function bt_the_title ($title) { if (current_user_can(‘administrator’)) { if (strlen($title) > 15) { $title=”<span class=”font18px”>” . $title . ‘</span>’; $title=”<span style=”font-size: 18px”>” . $title . ‘</span>’; } } return $title; } add the code in … Read more