BACK TO DIRECTORY

Shortcode Callback

by digitalpoint

5.0
(1 ratings)

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.

Plugin Details

Active Installs
10
Total Downloads
2,233
Version
1.0.0
Requires WP
2.5
Requires PHP
Tested Up To
4.3.0
Added
2015-06-18
Last Updated
2015-08-17 6:08pm GMT

Ratings

5
1
4
0
3
0
2
0
1
0