• I want to highlight part of a certain post, different background maybe or a frame.. how can i do that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • If you use the HTML tab, you could place the highlighted content within something like <div class="highlight">[...]</div> and then add a background color via CSS:

    .highlight {
    background-color:#ffc;
    }
    Thread Starter Shaooxz

    (@shasoosh)

    is there a simple plugin for that?

    Thread Starter Shaooxz

    (@shasoosh)

    maybe to add the code so i’ll only need to use shorcode in my posts next time?

    Here is some code for you to add to your functions.php. You will need to tweak the style to suit yourself.

    Be careful when changing functions.php – you can disable your whole site. Be sure to make a backup copy first, and understand how to copy it back before you make any changes.

    <?php // [mm-hilite]some text here[/mm-hilite]
    function mm_hilite_func($atts, $content=null) {
    	extract(shortcode_atts(array(
    		'noatts' => 'Unknown',
    	), $atts));
    	$output = '';
       if (!is_null($content)) {
    		$output = "<span style='background: green; font-weight: bold;'>$content</span>";
       }
       return $output;
    }
    add_shortcode('mm-hilite', 'mm_hilite_func');
    ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how can i highlight part of my post’ is closed to new replies.