Just wondering why it seems you can only user one shortcode per php file for a plugin?
Im using them to call functions and require several in one file as opposed to one file for each function/shortcode.
any way around this?
Just wondering why it seems you can only user one shortcode per php file for a plugin?
Im using them to call functions and require several in one file as opposed to one file for each function/shortcode.
any way around this?
Err... what?
I don't fully understand exactly what you mean here. It's perfectly possible to define several shortcodes in one PHP file.
oh?
this doesnt work for me
function show_index(){
echo 'Example 1';
}
add_shortcode('myshow', 'show_index');
function show_text() {
echo 'Example 2';
}
add_shortcode('myshow', 'show_text');
the problem is that in the content where I put [myshow show_index] it is always showing the output from function show_text instead...
Err.. you can't do that. That's not defining several shortcodes, that's defining the same shortcode twice. The second one overrides the first one.
You can only define any given shortcode once.
I suggest you reread the Shortcode API documentation.
This topic has been closed to new replies.