An answer to this would interest me as well
Hi @ukrainaevents and @tawarien,
Unfortunately, we do not currently support passing though custom arbitrary attributes through to the shortcode function.
It’s definitely something we could add in the future – if you’re able to create a new feature request on our roadmap site (https://roadmap.codesnippets.pro/) then I’ll definitely look into it for an upcoming version.
In the meantime, what you are looking to achieve might be more easily accomplished by writing a Function snippet that calls add_shortcode
directly.
Function snippet that calls add_shortcode
directly.
—-
can y pls show example?
Here is an example:
// Change this into something more appropriate.
$shortcode_tag = 'my_shortcode';
add_shortcode( $shortcode_tag, function ( $atts ) use ( $shortcode_tag ) {
$atts = shortcode_atts( [
'idd' => '',
], $atts, $shortcode_tag );
$category = get_category( $atts['idd'] );
$count = $category->count;
if ( $count > 1 ) {
return sprintf( '<span class="rv1">%s reviews</span>', $count );
}
return '';
} );