Shortcodes in attributes won't work if you are using WordPress' Shortcode API. They will work in content between opening & closing shortcodes but for that the outer shortcode will have to parse the content of the one inside.
So this will work:
PHP Code:
add_shortcode( 'test', 'parse_test_tag' );
add_shortcode( 'test_more', 'parse_test_more_tag' );
function parse_test_tag( $attrs, $content = '' ) {
extract( shortcode_atts( array(
'att_a' => '',
'att_b' => '',
), $attrs ) );
$content = do_shortcode( $content );
//do some more stuff here
return $content;
}
function parse_test_more_tag( $attrs, $content = '' ) {
extract( shortcode_atts( array(
'att_y' => '',
'att_z' => '',
), $attrs ) );
//do some more stuff here
//do some more stuff here
return $content;
}
But this won't work:
PHP Code:
add_shortcode( 'test', 'parse_test_tag' );
add_shortcode( 'test_more', 'parse_test_more_tag' );
function parse_test_tag( $attrs, $content = '' ) {
$attrs = array_map( 'do_shortcode', $attrs ); //this & the foreach to go through all values in $attrs is one & same
//but this won't work as the tags will come up as broken & muxed up with attr values, so nothing will be here to parse
//for the do_shortcode()
extract( shortcode_atts( array(
'att_a' => '',
'att_b' => '',
), $attrs ) );
//once $attrs is passed through shortcode_atts() then the remnants of broken tags will be gone as well
return $content;
}
function parse_test_more_tag( $attrs, $content = '' ) {
extract( shortcode_atts( array(
'att_y' => '',
'att_z' => '',
), $attrs ) );
//do some more stuff here
//do some more stuff here
return $content;
}
If you want to parse shortcodes in attributes then the only way is to write your own parser for the parent tag and use Shortcode API on the value of parent tag's attributes or write your own parser for them as well.
Bookmarks