That happens, because you run the function in add_shortcode()
. To send is as callback, use:
add_shortcode('examp_code', array ( $obj, 'ex_funct' ) );
Now you have still a problem: you create output in your shortcode callback. Never do that, you have to return a string.
Change it to:
function ex_funct(){
return '<h3>Hello</h3>';
}
Related Posts:
- How to add a shortcode button to the TinyMCE editor?
- Get plugin_dir_url() from one level deep within plugin
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- Namespaces in WordPress – How do I initiate the main class?
- enqueue script only if it is not already enqueue
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How To Ignore a Filter On Applying Filter the Content In a Function
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- shortcode doesn’t work
- How to include and use custom class files in plugin?
- How to add inline css/js inside a shortcode
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Current user in plugin returns NULL
- Demystifying and understanding shortcode nomenclature
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- Input with spaces in Shortcode attributes overwritten by defaults
- Allow users of my plugin to define their own shortcode rather than use mine?
- Making a Template for a CPT created by a plugin
- creating html reusable blocks via shortcodes
- Single API call exposed via shortcode with params
- Creating shortcodes in plugin
- How to create a custom shortcode based on the layout?
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- Namespaced shortcode?
- Why is my custom post type not being activated on plug-in activation?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Why am I unable to load scripts in head in plugin?
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- IF condition based on wp_remote_get output
- Shortcode Attributes to Return different $_POST
- get_option / wp_localize_script Not Working in OOP Plug In
- Built a second plugin but it overwrote the first one
- How to use template inside plugin shortcode with variables for big HTML code
- strange shortcode error: does shortcodes requires any dependency?
- WordPress Object Oriented plugin development [closed]
- How to access OOP plugin function inside themes or other plugin
- How to rewrite URL and get the values?
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- Shortcode do not return the right data in post
- How to call function in WordPress on button click?
- Hide content for specific users with id
- Why is my shortcode not working?
- WordPress plugin blog creation
- Get post content inside plugin class method
- WP Plugin CSS not being applied to page
- How to access classes in theme of a plugin?
- Modify Plugin PHP Class in Child Theme – Correct Method
- Shortcode in a blog post, footer and related products stop working
- shortcode which is introduced into entry the blog, and appears in side bar
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Shortcode registered from a plugin not recognized
- Any way to hook into WP after a page displays?
- Plugin: Custom menu item problem
- Function not being called on form submit, only blank admin-post.php page
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Display file contents within Plugin
- Is it possible to use Classes between WordPress plugins with separate namespaces?
- How to get next day date of a specific day
- Custom Plugin not Displaying in the Website Production environment (Divi)
- Private Plugin Updates – Localhost
- How to change custom post type pemalink Hierarcy
- tag breaks shortcode output (other solutions don’t work)
- Any hook for pre-plugin-update -either bulk or single plugin update
- Get plugin option in another PHP file
- wp_create_nonce function doesn’t work inside a plugin?
- Test files for plugin development
- Unable to override pluggable function wp_mail
- Avoid class name collision when using third party libraries in plugins?
- How to create custom tables in WordPress using my own plugin?
- How can I create a custom shortcode that will return a custom post type by ID?
- New User Form – Custom Menu Page
- Own plugin corrups plugin-activation
- wordpress plugin is not activating from widget
- All Users > User List > Update User Meta Field Inline
- Checking instances of scripts in wp_head
- How to save post change url youtube link?
- plugin class inheritance. cannot change variable
- Best approach to fetch data from wp options to js file or php file
- Correct way to perform non-cacheable DB query
- Plugin Handle URL With Custom Theme
- Is it possible to create Custom Post plug-in?
- uninstall.php file in Plugin to clean DB
- Archive – same title for the first two posts
- Creating a plugin to sanitize comment and the url field before display only
- Edit Yoast SEO breadcrumbs output [closed]
- Creating plugin using simple_html_dom parser?
- Object Oriented Plugin not working
- Adding Shortcode to Text Widget
- How to put JQuery/Ajax inside shortcode?
- Does WP identify plugin by plugin name or plugin_basename?
- switched from query_posts to WP_query, not working now?
- Making a plugin only available on the front-end for the logged in super admin
- wordpress prevent multiple shortcodes
- Create entire wordpress as a github repositery?