Forums

need help with short code (2 posts)

  1. MataX
    Member
    Posted 1 year ago #

    Basically I want to know how to use a short code command to make a special style for quoted text, as in I can type something like...

    [quoted]
    This is quoted text
    [/quoted]

    and it would like change the background color of that section of text and do some other styles to it as well

    Can anyone help me understand how to do this?

  2. In theory, put this in your functions.php:

    function quoted_shortcode( $atts, $content = null ) {
       return '<span class="quoted">' . $content . '</span>';
    }
    add_shortcode('quoted', 'quoted_shortcode');

    Then make a CSS class for quoted :)

    Read http://codex.wordpress.org/Shortcode_API for more help.

Topic Closed

This topic has been closed to new replies.

About this Topic