shortcode in plugins
Hello, I am using the Visual Form Builder plugin. I wanted to write a function and then display the output using shortcodes. I am new to PHP and wordpress coding. I tried the foobar shortcode example.
When I inserted that function in functions.php, it worked fine and showed the correct output i.e. foo and bar. But using the same function inside the plugin files does not give any output and [foobar] is displayed. The same plugin class has add_shortcode written in _construct. I followed suit, put add_shortcode for foobar inside the _construct function and I created a public foobar_func outside the _construct function but inside the class, like a regular method. But this does not work. In fact I wanted to use this with a different file that’s part of the plugin and gets included in the main plugin PHP file.
How do I get this to work?
- The topic ‘shortcode in plugins’ is closed to new replies.