WordPress.org

Forums

shortcodes
select menu shortcode (3 posts)

  1. zhinokin
    Member
    Posted 3 years ago #

    Hi i just want a little help. i'm making this shortcode.

    The problem is i don't know where to place the <select> tag.

    function jumptoCourse($atts, $content = null)
    {
    	extract(shortcode_atts(array('value' => '#'), $atts));
    	return '<option value="'.$value.'"> '.do_shortcode($content).' </option>';
    }
    add_shortcode('jump', 'jumptoCourse');

    I do it this way placing the <select> tag.

    return '<select><option value="'.$value.'"> '.do_shortcode($content).' </option></select>';

    and its not right coz it will generate the select tag per value.

    I'm just a starter on learning this shortcodes. Please help

    http://wordpress.org/extend/plugins/shortcodes/

  2. bbarton
    Member
    Posted 3 years ago #

    Are you trying to parse a nested shortcode tag? Can you provide your shortcode?

  3. zhinokin
    Member
    Posted 3 years ago #

    Yes i'm thinking of parsing a nested shortcode since i don't know where to place the <select> tag on the fuction jumptoCourse(). So i think of nested parsing. But i think their is also a way of doing that without being nested i guess.

    function selectCourse($content = null) {
    	return '<select id="dynamic_select">'.do_shortcode($content).'</select>';
    }
    add_shortcode('select', 'selectCourse');
    
    function jumptoCourse($atts, $content = null) {
    	extract(shortcode_atts(array('value' => '#'), $atts));
    	return '<option value="'.$value.'"> '.do_shortcode($content).' </option>';
    }
    add_shortcode('jump', 'jumptoCourse');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags