I’m having trouble adding the most basic of shortcodes, and I’m wondering if I’m doing something wrong (based on several tutorials I’ve read), or if I have to do something special to get it to work with X Theme.
Adding some code like this to my functions.php child theme ends up just displaying the shortcode itself, not the output:
function s100atest() {
return ‘hello’;
}
add_shortcode(‘certificatenumber’, ‘s100atest’);
or
function s100atest() {
$s100aOutput = ‘hello’;
return $s100aOutput;
}
add_shortcode(‘certificatenumber’, ‘s100atest’);
I’ve seen some tutorials that use ‘init’ and things that talk about registering the shortcode with your theme and stuff, so we’ve also tried:
function s100atest() {
return ‘hello’;
}
add_action( ‘init’, ‘register_shortcodes’);
function register_shortcodes(){
add_shortcode(‘certificatenumber’, ‘s100atest’);
}
None of them seem to work… they just output [certificatenumber] in the text, so WordPress isn’t seeing it as an actual shortcode. What am I missing? Thanks!