There are 2 major bugs here
Problem 1: Your shortcode registration is invalid
You should be seeing lots of messages about this in your PHP error log
add_shortcode('splite', 'splite_article');
There is no function named splite_article
, there’s a class function but the code didn’t tell it to use it. So instead of calling your shortcode function, it generates a PHP error message and puts it in the log.
add_shortcode
expects a PHP callable value, so splite_article
is equivalent to splite_article()
, but you need $this->splite_article()
.
So instead use the appropriate callable [ $this, 'splite_article' ]
Problem 2: Shortcodes do not echo
echo $content;
That’s not how shortcodes work, shortcode callbacks do not echo HTML, they return it. This shortcode will be breaking a lot of things as a result of this.
Luckily the solution is simple, return
the shortcodes content instead.
Related Posts:
- How to customise the output of the WP image gallery shortcode from a plugin?
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- Shortcode output appears before post body [duplicate]
- PHP Deprecated: Non-static method should not be called statically
- How to parse nested shortcodes?
- How to call shortcode function directly and pass $atts
- How to pass multiple values in shortcode?
- change plugin shortcode function [closed]
- Calling function from within functions.php returns unwanted value
- Dynamic HTML not displaying at respective place
- Plugin form unable to process
- Short code for Venues
- Frontend editing, Frontend user dashboard
- Can’t get custom posts of taxonomy to show
- Shortcode doesn’t work if I directly paste its function in a template file?
- May i Use ShortCode in Template?
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- get shortcode value
- How to generate CSS from a shortcode within a plugin
- Storing Options in a Shortcode
- Prevent shortcode from being wrapped in tags
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Plugin Handle URL With Custom Theme
- How to put JQuery/Ajax inside shortcode?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Can someone please tell me what is wrong with my plugin?
- Trouble with editing template for “List category posts” plugin
- WordPress function not being called from jQuery method
- AddToAny shortcode in the loop
- How to fix wrong attribute error for Visual Composer Grid Builder?
- Making a Template for a CPT created by a plugin
- Shortcode Plugin to dynamically build a shortcode via `do_shortcode` not working
- Making sure that a plugin’s scripts and stylesheets are included for dynamicaly loaded content
- Creating shortcodes in plugin
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Use $_GET inside a shortcode print empty Array
- My plugin won’t return anything [closed]
- Render Modula Plugin Shortcode On Ajax Request
- Shortcode to update user meta
- Why shortcode always displayed after footer not in body
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Deactivate JS Script in Plugin Shortcode
- Where to find the code used to render a page that has a shortcode and a template defined?
- Shortcode not working after move wordpress website files
- Shortcode not getting replaced
- convert more tag to shortcode
- Plugin that provides the [edit] shortcode?
- Return multiple values in a shortcode attribute
- How to change shortcode’s default theme?
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- Is there a way to convert shortcodes to html content?
- How to use template inside plugin shortcode with variables for big HTML code
- Loop returns the current page’s permalink and guid instead of the post in the loop
- How to rewrite URL and get the values?
- How to prevent tabs from opening all at once
- Executing Javascript in Plugin
- Shortcode and variable
- How can I achieve this, using shortcodes
- Elementor Pro display featured image on section -> style -> image using shortcode
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How To Use do_shortcode with WooCommerce One Page Checkout
- How to get current cart values using WC_Shortcodes?
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- How to check if short code is present in template?
- Shortcode show error while editing post
- Get Shortcode output to database for static post_content
- Issue Saving Posts That Contain Shortcode
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- How to use plugin’s shortcode in custom design? [closed]
- WordPress show descriptions under images in gallery
- WP Plugin CSS not being applied to page
- Modify Plugin PHP Class in Child Theme – Correct Method
- How to add HTML to a template only when user is logged out/ not registered
- Multiple calling javascript from shortcode in one page
- How to pass value to a plugins shortcode?
- Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?
- Find all strings between an enclosing shortcode
- Hide some shortcodes on posts from back-end
- Trouble implementing python on WordPress
- Is there a function to search for a wildcard value when calling a shortcode?
- How to display single arbitrary facebook post with a shortcode?
- Multiple level shortcodes
- Custom shortcode with dynamic rewrite
- Posting code inside the post instead of in the template file using shortcode
- apply_filters to content but ignore shortcodes
- How to load a plugin when doing an Ajax call? [duplicate]
- Is it right way to create shortcode?
- Trying to override/intercept a PhotoMosaic gallery link in WordPress using jQuery
- Trying to Understand Shortcodes.
- Creating Features List in WordPress Post
- I am experiencing difficulty fulfilling client request
- Shortcode to do math with url variables
- How to get URL param for pagination in shortcode?
- Buffered output in chunks and shortcode – how do I achieve that?
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode