I need to display parts of the post title in italic.
So when writing a title like Lorem <i>ipsum</i> dolor sit
it should be displayed as
Lorem ipsum dolor sit
We’re using the Classic editor, not Gutenberg, and there is no way we will change this at the moment.
But I do have access to the theme and could change things in here.
Any chance to get HTML codes in the title working?
2
Answers
I have had success in getting WordPress post/page titles to render italics by placing either
<i>
or<em>
tags into the title using the "Quick Edit" feature found on the Posts (or Pages) page. The "Quick Edit" feature appears when you hover over a particular post, and it only lets you edit the post’s main information (title, author, tags, etc.), but for some reason, it will render HTML tags within the title if they are entered there.I am not sure why WordPress works the way it does with regard to this, but that’s how I get titles to render HTML tags within themselves. Inserting the tags into the title via the main WordPress editor, as you noticed, doesn’t seem to work.
You can use
**
(markdown italic) in your title, and applythe_title
filter:For example
My *italic* title
will returnMy <i>italic</i> title