1. My shortcodes
I've developed multiple shortcodes for my own theme, I'm loading them in functions.php like this require_once (MY_URL . '/bartag_shortcode.php')
.
Here's an exemplary bartag shortcode from WordPress Codex:
function bartag_func( $atts ) {
extract( shortcode_atts( array(
'foo' => 'something',
'bar' => 'something else',
), $atts ) );
return "foo = {$foo}";
}
add_shortcode( 'bartag', 'bartag_func' )
2. How to list all of them?
- I'm not even sure if I can do that, since the add_shortcode() doesn't allow to group shortcodes, so I guess it will be pretty hard to distinguish my shortcodes from the others (from plugins, or other sources). Any ideas? I could loop trough all of shortcodes containing files using
foreach(glob('*.php') as $shortcode)
andfile_get_contents
with some regex, but when it comes to performance this is one of the dumbest ideas I've ever came up with. - If that's not possible then how to display a list of all active shortcodes, so I could filter them somehow (I could add a prefix to the ones created by me and then list all shortcodes starting with this prefix).
Thanks!