• Resolved 3Plumes

    (@3plumes)


    This may not be the best solution, so if you can think of another way to do this, I would love to know.

    I’m trying to make it easy to enter a definition list via the visual editor (and not in html view) for basic users in a site. The output should be something similar to this:

    <dl class="service">
    <dt>Name of Service</dt>
    <dd class="price">Price</dd>
    <dd class="desc">Description of Service</dd>
    </dl>

    I’ve been trying to create shortcodes to handle this, but I haven’t been successful. This is what I’ve tried:

    /* ====== Shortcode: Service Item */
    function register_shortcode_item($atts, $content = null) {
           return '<dt>' . $content . '</dt>';
        }
        add_shortcode("item", "register_shortcode_item");       
    
    /* ====== Shortcode: Service Price */
    function register_shortcode_price($atts, $content = null) {
           return '<dd class="price">' . $content . '</dd>';
        }
        add_shortcode("price", "register_shortcode_price");       
    
    /* ====== Shortcode: Service Description */
    function register_shortcode_description($atts, $content = null) {
           return '<dd class="description">' . $content . '</dd>';
        }
        add_shortcode("description", "register_shortcode_description");

    For some reason, everything seems to work fine, except it’s not parsing all the shortcodes (price). I enter:

    [service][item]Mini Manicure[/item][price]$25[/price][description]description goes here[/description][/service]

    Can anyone point me in the right direction?

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter 3Plumes

    (@3plumes)

    Okay, I figured it out. I placed spaces in between the shortcodes (closing and opening), and it started working.

Viewing 1 replies (of 1 total)

The topic ‘Shortcode Confusion’ is closed to new replies.