{"id":37058,"date":"2015-06-18T21:14:46","date_gmt":"2015-06-18T21:14:46","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/shortcode-callback\/"},"modified":"2015-08-17T18:08:56","modified_gmt":"2015-08-17T18:08:56","slug":"shortcode-callback","status":"publish","type":"plugin","link":"https:\/\/twd.wordpress.org\/plugins\/shortcode-callback\/","author":13777004,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.0","stable_tag":"1.0.0","tested":"4.3.0","requires":"2.5","requires_php":"","requires_plugins":"","header_name":"Shortcode Callback","header_author":"Digital Point","header_description":"","assets_banners_color":"56524d","last_updated":"2015-08-17 18:08:56","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/marketplace.digitalpoint.com\/shortcode-callback.3383\/item#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin","header_plugin_uri":"https:\/\/marketplace.digitalpoint.com\/shortcode-callback.3383\/item","header_author_uri":"https:\/\/www.digitalpoint.com\/","rating":5,"author_block_rating":0,"active_installs":10,"downloads":2057,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"1"},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":"1184377","resolution":"128x128","location":"assets"},"icon-256x256.png":{"filename":"icon-256x256.png","revision":"1184377","resolution":"256x256","location":"assets"}},"assets_banners":{"banner-1544x500.jpg":{"filename":"banner-1544x500.jpg","revision":"1184377","resolution":"1544x500","location":"assets"},"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":"1184377","resolution":"772x250","location":"assets"}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[6966,13513,662,6438,80],"plugin_category":[43],"plugin_contributors":[78661],"plugin_business_model":[],"class_list":["post-37058","plugin","type-plugin","status-publish","hentry","plugin_tags-bbcode","plugin_tags-callback","plugin_tags-php","plugin_tags-short-code","plugin_tags-shortcode","plugin_category-customization","plugin_contributors-digitalpoint","plugin_committers-digitalpoint"],"banners":{"banner":"https:\/\/ps.w.org\/shortcode-callback\/assets\/banner-772x250.jpg?rev=1184377","banner_2x":"https:\/\/ps.w.org\/shortcode-callback\/assets\/banner-1544x500.jpg?rev=1184377","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/shortcode-callback\/assets\/icon-128x128.png?rev=1184377","icon_2x":"https:\/\/ps.w.org\/shortcode-callback\/assets\/icon-256x256.png?rev=1184377","generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>The Shortcode Callback plugin allows you to use a [callback] shortcode to execute arbitrary PHP code wherever the shortcode is used.<\/p>\n\n<p><strong>Usage<\/strong><\/p>\n\n<p>Execute someFunction() and insert whatever it returns with the following shortcode:\n    [callback function=\"someFunction\"]<\/p>\n\n<p>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:\n    [callback include=\"custom\/filetoinclude.php\" function=\"someFunction\"]<\/p>\n\n<p>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:\n    [callback function=\"someFunction\" include=\"custom\/filetoinclude.php\" param=\"something\"]<\/p>\n\n<p>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.\n    [callback function=\"someClass::someFunction\" include=\"custom\/filetoinclude.php\" param=\"something\"]<\/p>\n\n<p>There is an example (with PHP code) <a href=\"https:\/\/wordpress.org\/plugins\/shortcode-callback\/faq\/\">over here<\/a>.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload <code>shortcode-callback<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory.<\/li>\n<li>Activate the Shortcode Callback plugin through the 'Plugins' menu in the WordPress admin area.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>Do you have an example of where the Shortcode Callback plugin is used?<\/dt>\n<dd><p>I built this plugin primarily because I needed a way to inject the \"Daily Yield\" and \"Total Yield\" numbers to <a href=\"https:\/\/shawnhogan.com\/solar-power-chart#utm_source=readme&amp;utm_medium=wordpress&amp;utm_campaign=plugin\">my solar power chart page<\/a>.<\/p><\/dd>\n<dt>The shortcode being used:<\/dt>\n<dd><p>[callback function=\"DigitalPointElectricity::total_output\" param=\"daily\" include=\"custom\/Electricity.php\"]<\/p><\/dd>\n<dt>The `custom\/DigitalPointElectricity.php` file being called by the shortcode:<\/dt>\n<dd><p>&lt;?php<\/p>\n\n<pre><code>class DigitalPointElectricity\n{\n    public static function total_output($timeframe)\n    {\n        $totals = $GLOBALS['memcache']-&gt;get('shawnhogan-pv-total');\n\n        if ($timeframe == 'total')\n        {\n            return $totals-&gt;Items[2]-&gt;TotalYield;\n        }\n        elseif ($timeframe == 'daily')\n        {\n            return $totals-&gt;Items[1]-&gt;DailyYield;\n        }\n    }\n}\n<\/code><\/pre><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release<\/li>\n<\/ul>","raw_excerpt":"Adds a [callback] shortcode that can trigger PHP code so you can insert custom\/complex things into your pages\/posts.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/37058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=37058"}],"author":[{"embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/digitalpoint"}],"wp:attachment":[{"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=37058"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=37058"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=37058"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=37058"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=37058"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/twd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=37058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}