Plugin info

Total downloads: 1,925
Active installs: 10
Total reviews: 1
Average rating: 5
Support threads opened: 0
Support threads resolved: 0 (0%)
Available in: 1 language(s)
Contributors: 1
Last updated: 8/17/2015 (3789 days ago)
Added to WordPress: 6/18/2015 (10 years old)
Minimum WordPress version: 2.5
Tested up to WordPress version: 4.3.0
Minimum PHP version: f

Maintenance & Compatibility

Maintenance score

Possibly abandoned • Last updated 3789 days ago • 1 reviews

22/100

Is Shortcode Callback abandoned?

Possibly abandoned (last update 3789 days ago).

Compatibility

Requires WordPress: 2.5
Tested up to: 4.3.0
Requires PHP: f

Similar & Alternatives

Explore plugins with similar tags, and compare key metrics like downloads, ratings, updates, support, and WP/PHP compatibility.

Inline Spoilers
Rating 4.6/5 (14 reviews)Active installs 1,000
bbPress2 BBCode
Rating 3.7/5 (6 reviews)Active installs 100
BBCode Deluxe
Rating 3.7/5 (3 reviews)Active installs 100
BBCode
Rating 4.0/5 (1 reviews)Active installs 80
WP MultiTasking – WP Utilities
Rating 0.0/5 (0 reviews)Active installs 50
azurecurve BBCode
Rating 5.0/5 (2 reviews)Active installs 40

Description

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.

Installation

  1. Upload shortcode-callback folder to the /wp-content/plugins/ directory.
  2. Activate the Shortcode Callback plugin through the ‘Plugins’ menu in the WordPress admin area.

Frequently Asked Questions

Do you have an example of where the Shortcode Callback plugin is used?

I built this plugin primarily because I needed a way to inject the “Daily Yield” and “Total Yield” numbers to my solar power chart page.

The shortcode being used:

[callback function=”DigitalPointElectricity::total_output” param=”daily” include=”custom/Electricity.php”]

The `custom/DigitalPointElectricity.php` file being called by the shortcode:

<?php

class DigitalPointElectricity
{
    public static function total_output($timeframe)
    {
        $totals = $GLOBALS['memcache']->get('shawnhogan-pv-total');

        if ($timeframe == 'total')
        {
            return $totals->Items[2]->TotalYield;
        }
        elseif ($timeframe == 'daily')
        {
            return $totals->Items[1]->DailyYield;
        }
    }
}

Review feed

No reviews available

Screenshots

No screenshots available

Changelog

1.0.0

  • Initial release