Adding Your Own Custom Shortcodes
-
Hello,
I’m working with the Better Notifications for WP (BNFW) plugin. I’m trying to introduce a custom shortcode.
I have another plugin that allows for the creation of custom shortcodes, but BNFW doesn’t seem to recognize those.
After some research, I came across instructions (https://betternotificationsforwp.com/documentation/adding-custom-shortcodes/) within the BNFW documentation that outlines how one might create their own custom shortcode that will work with BNFW.
I tried adding the following code in wp-includes/function.php as instructed.
function bnfw_shortcode_HelloWorld() {
$HelloWorld = “Hello World”;
return $HelloWorld;
}
add_shortcode( ‘HelloWorld’, ‘bnfw_shortcode_HelloWorld’ );When I save and load the site, I get this error: Fatal error: Uncaught Error: Call to undefined function add_shortcode() in…
I’m not sure what I’m doing wrong. I’m new to Word Press / PHP. I’m probably not seeing what someone with more experience might be seeing. Any help / suggestions I can get are appreciated.
Thanks
- The topic ‘Adding Your Own Custom Shortcodes’ is closed to new replies.