I am working on building some shortcodes for my blog. I can set a single parameter for my shortcode, but not sure how to set different parameter.
For example, I can use [myshortcode myvalue]
to output a html block within the post content.
Here is what I am currently using:
function test_shortcodes( $atts ) {
extract( shortcode_atts( array(
'myvalue' => '<div class="shortcodecontent"></div>'
), $atts ) );
return $myvalue;
}
add_shortcode( 'myshortcode', 'test_shortcodes' );
Now, how can I use [myshortcode myothervalue]
to output a different block of html?
Please note that the shortcode is same, only the parameter is changed.
myvalue="something"
, right? – s_ha_dum Feb 4 '13 at 14:35