Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Suppose I am writing a post and want to highlight only a couple of characters: like this. How can I achieve this?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

HTML language includes a special tag for displaying inline code. To apply it to your text, switch to the 'Text' visual editor tab and place the <code> tag before your bit of code, and the </code> tag afterwards.

If you want to use the backtick ` character for highlighting code like you do on Stack Overflow, check out this plugin by Tom McFarlin.

share|improve this answer
thanks great answer.we should always answer in WordPress way if their any.I'm a newbie and learning how to answer on stackoverflow or solve a problem in wordpress way.thanks again. –  Ravs Jun 7 '13 at 12:37
@Ravs this is the best way for WordPress and everything overall. You shouldn't try and emulate a <code> tag by using a <span> tag. And shortcodes are not supposed to be used for plain HTML, that's what HTML is for –  bungeshea Jun 7 '13 at 23:55
add comment

you can create a shortcode for this

function ravs_hightlight( $atts, $content=""){
  return '<span class="highlight">'.$content.'</span>';

paste above code in functions.php.

use shortcode in wordpress editer like

[highlight]test for hightlight short code[/highlight]

your html output like

<span class="highlight">test for hightlight short code</span>

give some css to .highlight class

Important Link:


share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.