WordPress.org

Ready to get started?Download WordPress

Forums

shortcode inside shortcode help (1 post)

  1. mxpimp47
    Member
    Posted 1 year ago #

    I am using a jquery script for some images to have a carousel. Testing it using divs in the text mode works fine on a page. So I created some shortcodes for the divs so its easier for non html savvy people to use. Only html needed is

    <div class="slider1">
    <div class="slide"><img src.../></div>
    </div>

    so the shortcodes I created are -

    /** Products */
    function product_shortcode( $atts, $content = null ) {
       return '<div class="slide">'.($content).'</div>';
    }
    add_shortcode('product', 'product_shortcode');
    
    /** scroll wrapper */
    function scroll_shortcode( $atts, $content = null ) {
       return '<div class="slide1">'. do_shortcode($content) .'</div>';
    }
    add_shortcode('scroll', 'scroll_shortcode');

    But it doesnt work. When typing the html to make it work, the jquery recognizes the div class "slider1" and wraps it with other html. And when using the shortcodes it renders the div class only.

    Any suggestions on this? I read this doc - http://codex.wordpress.org/Function_Reference/do_shortcode but it didnt help.

Topic Closed

This topic has been closed to new replies.

About this Topic