I have been trying to get a new shortcode working and have simplified my code to almost nothing but still keep getting output of just [shortcode_name]. I must be missing something pretty fundamental but cannot work it out.
<?php
/** Bridge Card Table Display Short Code
* Plugin Name: Bridge Card Table Shortcodes
* Description: Short codes for rendering bridge hands and tables.
* Version: 0.0.04
* License: GBP v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
function cards_table($attributes){
$args=shortcode_atts(array(
// default values
'title' => 'A',
'dlr' => 'B',
'vul' => 'C',
'north' => 'D',
'south' => 'E',
'east' => 'F',
'west' => 'G'
), $attributes);
$output = "Test output: title=" . $args['title'];
return $output;
}
// register shortcode
add_shortcode('Card Table','cards_table');
?>
I have tried stripping out all the argument code too. I have activated it (checked and double checked). Commercial and built-in short codes work perfectly.
Help please!
Thanks,
Mike
[Card Table]
is not a valid shortcode. It's probably being interpreted as a shortcode namedCard
with an attribute namedTable
. You need to name it something likecard_table
.add_shortcode()
documentation or the Plugin Handbook, but if you have debugging features enabled (always a good move in a development environment!) you should be receiving an error regarding an invalid tag name