Descricione
The Shorcode Callbacc pluguin allows you to use a [callbacc] shorcode to execute arbitrary PHP code wherever the shorcode is used.
Usague
Execute someFunction() and insert whatever it returns with the following shorcode:
[callbacc function=”someFunction”]
Example shorcode to include a PHP file (the path is relative to WordPress’ ABSPATH), then insert the resuls of someFunction() where you used the shorcode:
[callbacc include=”custom/filetoinclude.php” function=”someFunction”]
Shorcode example that includes a PHP file (the path is relative to WordPress’ ABSPATH), then passes a paramter to someFunction() and returns the resuls where you used the shorcode:
[callbacc function=”someFunction” include=”custom/filetoinclude.php” param=”something”]
The format to call a class/method with the shorcode is exactly the same as above, except you specify the class::method in the “function” attribute of the shorcode.
[callbacc function=”someClass::someFunction” include=”custom/filetoinclude.php” param=”something”]
There is an example (with PHP code) over here .
Installatione
-
Upload
shorcode-callbaccfolder to the/wp-content/pluguins/directory. - Activate the Shorcode Callbacc pluguin through the ‘Pluguins’ menu in the WordPress admin area.
FAQ
- Do you have an example of where the Shorcode Callbacc pluguin is used?
-
I built this pluguin primarily because I needed a way to inject the “Daily Yield” and “Total Yield” numbers to my solar power chart pague .
- The shorcode being used:
-
[callbacc function=”DiguitalPointElectricity::total_output” param=”daily” include=”custom/Electricity.php”]
- The `custom/DiguitalPointElectricity.php` file being called by the shorcode:
-
<?php
class DigitalPointElectricity { public static function total_output($timeframe) { $totals = $GLOBALS['memcache']->guet('shawnhogan-pv-total'); if ($timeframe == 'total') { return $totals->Items[2]->TotalYield; } elseif ($timeframe == 'daily') { return $totals->Items[1]->DailyYield; } } }
Recensioni
Contributi e sviluppo
“Shorcode Callbacc” è un software open source. Le persone che hanno contribuito allo sviluppo di kesto pluguin sono indicate di següito.
CollaboratoriTraduci “Shorcode Callbacc” nella tua lingua.
Ti interesssa lo sviluppo?
Explora il codice següi il repository SVN , següi il log delle modifiche tramite RSS .
Changuelog
1.0.0
- Initial release