How to pass multiple values in shortcode?

All

I am using formidable plugin and on one page i need to use 5 shortcodes.

[frm-entry-delete-link id=9 page_id=25 field_key=hsn108]
[frm-entry-delete-link id=12 page_id=25 field_key=cp7pi]
[frm-entry-delete-link id=13 page_id=25 field_key=ksa9qv]
[frm-entry-delete-link id=14 page_id=25 field_key=9zuf6o]
[frm-entry-delete-link id=15 page_id=25 field_key=w8w7op]

Is that possible to pass this all in single short code ?

Solutions Collecting From Web of "How to pass multiple values in shortcode?"

You can create your own shortcode which will hold all of that for you hardcoded:

add_shortcode("my_five_forms","my_five_forms_handler");
function my_five_forms_handler($atts,$content =null){
    $con =  "[frm-entry-delete-link id=9 page_id=25 field_key=hsn108]
        [frm-entry-delete-link id=12 page_id=25 field_key=cp7pi]
        [frm-entry-delete-link id=13 page_id=25 field_key=ksa9qv]
        [frm-entry-delete-link id=14 page_id=25 field_key=9zuf6o]
        [frm-entry-delete-link id=15 page_id=25 field_key=w8w7op]";

    return do_shortcode($con);
}

   // and use it like this:
   [my_five_forms]

or create a shortcode that will render all forms dynamicly

add_shortcode("my_n_forms","my_n_forms_handler");
function my_n_forms_handler($atts,$content=null){
    extract( shortcode_atts( array(
        'id_page_key' => '',
    ), $atts ) );
    $con = '';
    foreach((array)$id_page_key as $f){
        $f = split(":",$f);
        $con .=  ' [frm-entry-delete-link id="'.$f[0].'" page_id="'.$f[1].'" field_key="'.$f[2].'"]';
    }

    return do_shortcode($con);
}

//and you use it like this:
   [my_n_forms id_page_key="12:25:hsn108,13:25:cp7pi"]

In short no. Shortcodes in general have keys they expect to deal with and a set way of processing them.

For instance:

[frm-entry-delete-link id=9 page_id=25 field_key=hsn108 id2=12 page_id2=25 field_key2=cp7pi]

won’t work as the shortcode will not recognise the keys id2,page_id2,field_key2. Nor can you do it using this method:

[frm-entry-delete-link id=9 page_id=25 field_key=hsn108 id=12 page_id=25 field_key=cp7pi]

As the later values replace the first.

You could get round this by creating a custom shortcode which just runs through and do_shortcodes each one, but really listing 5 short-codes is fine – and a custom shortcode would be an unnecessary waste, and perhaps more confusing than listing them individually.

Have a read of the shortcode API which explains everything you need to know about using and developing shortcodes.

http://codex.wordpress.org/Shortcode_API