• Edit your theme's functions.php and add after <?php:
    Code: 
    include 'shortcode.php';
  • Create a new file in your theme's directory named shortcode.php
  • Paste this:
    Code: 
    <?php
    function underline( $attr, $content = null ) {
        return '<font style="text-decoration:underline;">' . $content . '</font>';
    }
    add_shortcode('u', 'underline');
    ?>
    u is the shortcode tag
    underline is the function name
    <font style="text-decoration:underline;"> is what comes before the content of the shortcode
    </font> comes after the shortcode
  • To use the shortcode, wrap them with [u] content here [/u ]
  • To add more, just duplicate the function above and replace the values to suit your needs.

    Here's a function for the [img] tag with the post's title used as an alt tag
    Code: 
    function image( $attr, $content = null ) {
        return '<img src="' . $content . '" alt="'.get_the_title($ID).'"/>';
    }
    add_shortcode('img', 'image');


Read More:
Apathetic Reviewed by Apathetic on . BBCode in Wordpress - W/O a plugin Edit your theme's functions.php and add after <?php: include 'shortcode.php'; Create a new file in your theme's directory named shortcode.php Paste this: <?php function underline( $attr, $content = null ) { return '<font style="text-decoration:underline;">' . $content . '</font>'; } add_shortcode('u', 'underline'); ?> Rating: 5