Adds a [callback] shortcode that can trigger PHP code so you can insert custom/complex things into your pages/posts.
Author: | Digital Point (profile at wordpress.org) |
WordPress version required: | 2.5 |
WordPress version tested: | 4.3.0 |
Plugin version: | 1.0.0 |
Added to WordPress repository: | 18-06-2015 |
Last updated: | 17-08-2015
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 100 |
Rated by: | 1 |
Plugin URI: | https://marketplace.digitalpoint.com/shortcod... |
Total downloads: | 1 546 |
Active installs: | 10+ |
Click to start download |
The Shortcode Callback plugin allows you to use a [callback] shortcode to execute arbitrary PHP code wherever the shortcode is used.
Usage
Execute someFunction() and insert whatever it returns with the following shortcode:
[callback function="someFunction"]
Example shortcode to include a PHP file (the path is relative to WordPress' ABSPATH), then insert the results of someFunction() where you used the shortcode:
[callback include="custom/filetoinclude.php" function="someFunction"]
Shortcode example that includes a PHP file (the path is relative to WordPress' ABSPATH), then passes a paramter to someFunction() and returns the results where you used the shortcode:
[callback function="someFunction" include="custom/filetoinclude.php" param="something"]
The format to call a class/method with the shortcode is exactly the same as above, except you specify the class::method in the "function" attribute of the shortcode.
[callback function="someClass::someFunction" include="custom/filetoinclude.php" param="something"]
There is an example (with PHP code) over here.
FAQ
ChangeLog