Shortcode is not working
-
Hello, my shortcode is not working where the code is in my custom plugin.
See the below code:
<?php class Ajax_Activity { function __construct() { $this->cld_add_custom_shortcode(); } public function cld_add_custom_shortcode(){ add_shortcode('sc', [$this, 'cld_generate_form']); } public function cld_generate_form(){ $form = ' <form id="green_form" action=""> field1:<br> <input type="text" name="field1" value=""> <br> field2:<br> <input type="text" name="field2" value=""> <br> <input type="submit" value="Submit"> </form>'; return $form; } }
Note: add_shortcode line is in a inner php file in my custom plugin.
I include this class by below way:<?php class Admin_Classes_Loader { function __construct() { require_once CA_FEEDER_DIR_PATH . '/admin/Ajax_Activity.php'; new Ajax_Activity(); } }
And this class loader is invoked in main plugin file.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Shortcode is not working’ is closed to new replies.