0

I run a blog on some kind of tutorial. Every page literally has 20 occurrences of a keyword that I try to explain. I need to "highlight" the keyword that is being used on every page.

Currently, I write down the whole post. Then save. Switch to Code Editor and then find each occurrence of the keyword. I wrap it around as follows:

Original:

keyword

After modifying:

<span style="background-color:#f7f9de;">keyword</span>

How can I make this kind of highlighting easier? Perhaps a way to quickly highlight this way by selecting the text and choosing a hotkey? I don't want to go into code editor and search/replace every occurrence because it quickly gets tedious.

  • Why not do a search and replace? find keyword replace with <span style="background-color:#f7f9de;">keyword</span>. Another option would be to make it bold or choose a text color in your visual editor (which adds the span) and then override that in your style.css as a permanent fix. – rudtek May 5 at 2:32
  • @rudtek I've tried doing that. There are a bunch of issues with it. Firstly,it is still tedious because you can't do a "replace all". Those keywords are sometimes used as normal words and also in the heading. So you want to make sure that you're skipping those. Secondly, for some reason, when you do a search-and-replace, then save the page, wordpress intermittently discards all those changes. I know that this sounds crazy, and I've tried the whole restart your browser, clear all cookies/sessions etc, and try again. But I've seen this bug intermittently on wordpress.I would rather use a hotkey. – Mugen May 5 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.