Title: Shortcode Callback
Author: digitalpoint
Published: <strong>18 ມິຖຸນາ 2015</strong>
Last modified: 17 ສິງຫາ 2015

---

ຄົ້ນຫາປລັກອິນ

![](https://ps.w.org/shortcode-callback/assets/banner-772x250.jpg?rev=1184377)

ປລັກອິນນີ້ **ຍັງບໍ່ທັນໄດ້ຮັບການທົດສອບກັບ WordPress 3 ເວີຊັນຫຼັກຫຼ້າສຸດ**. ມັນອາດຈະ
ບໍ່ໄດ້ຮັບການເບິ່ງແຍງ ຫຼື ສະໜັບສະໜູນອີກຕໍ່ໄປ ແລະ ອາດມີບັນຫາການເຮັດວຽກຮ່ວມກັນເມື່ອ
ໃຊ້ກັບ WordPress ເວີຊັນທີ່ໃໝ່ກວ່າ.

![](https://ps.w.org/shortcode-callback/assets/icon-256x256.png?rev=1184377)

# Shortcode Callback

 ໂດຍ [digitalpoint](https://profiles.wordpress.org/digitalpoint/)

[ດາວໂຫຼດ](https://downloads.wordpress.org/plugin/shortcode-callback.1.0.0.zip)

 * [ລາຍລອຽດ](https://lo.wordpress.org/plugins/shortcode-callback/#description)
 * [ການຣີວິວ](https://lo.wordpress.org/plugins/shortcode-callback/#reviews)
 *  [ການຕິດຕັ້ງ](https://lo.wordpress.org/plugins/shortcode-callback/#installation)
 * [ການພັດທະນາ](https://lo.wordpress.org/plugins/shortcode-callback/#developers)

 [ການຊ່ວຍເຫຼືອ](https://wordpress.org/support/plugin/shortcode-callback/)

## ຄຳອະທິບາຍ

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](https://wordpress.org/plugins/shortcode-callback/faq/).

## ການຕິດຕັ້ງ

 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.

## ຄຳຖາມທີ່ພົບເລື້ອຍ

  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](https://shawnhogan.com/solar-power-chart#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin).

  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;
            }
        }
    }
    ```

## ການຣີວິວ

![](https://secure.gravatar.com/avatar/229f6fc906343a77a77da40bc87986775794c3adefb75e1c25f1c42664705422?
s=60&d=retro&r=g)

### 󠀁[Great way to add custom functionality](https://wordpress.org/support/topic/great-way-to-add-custom-functionality/)󠁿

 [warpenstein](https://profiles.wordpress.org/warpenstein/) 29 ທັນວາ 2016

This is a really good way of adding some custom code without having to create a 
new WP plugin. Simply add a php file to your wordpress and display the result using
a shortcode. Just remember: Don’t use echo or print in your functions or the output
will be displayed above your post and not where your shortcode is. To display contents
correctly always return them as shown in the examples. To render template files 
with lots of html: ob_start() require 'my_custom_template.php'; $contents = ob_get_contents();
ob_end_clean(); The resulting output will be stored in the $contents variable thanks
to the output buffer. The template file can contain php which will be interpreted
like every file that is being included using require().

 [ ອ່ານການຣີວິວທັງໝົດ 1 ລາຍການ ](https://wordpress.org/support/plugin/shortcode-callback/reviews/)

## ຜູ້ຮ່ວມພັດທະນາ ແລະ ຜູ້ພັດທະນາ

“Shortcode Callback” ແມ່ນຊອຟແວໂອເພັນຊອດ (Open Source). ບຸກຄົນຕໍ່ໄປນີ້ໄດ້ມີສ່ວນຮ່ວມ
ໃນການພັດທະນາປລັກອິນນີ້.

ຜູ້ຮ່ວມພັດທະນາ

 *   [ digitalpoint ](https://profiles.wordpress.org/digitalpoint/)

[ແປ “Shortcode Callback” ເປັນພາສາຂອງເຈົ້າ.](https://translate.wordpress.org/projects/wp-plugins/shortcode-callback)

### ສົນໃຈຮ່ວມພັດທະນາບໍ່?

[ເບິ່ງລະຫັດ](https://plugins.trac.wordpress.org/browser/shortcode-callback/), ກວດເບິ່ງ
[ຄັງເກັບ SVN](https://plugins.svn.wordpress.org/shortcode-callback/), ຫຼື ຕິດຕາມ
[ບັນທຶກການພັດທະນາ](https://plugins.trac.wordpress.org/log/shortcode-callback/) ຜ່ານ
[RSS](https://plugins.trac.wordpress.org/log/shortcode-callback/?limit=100&mode=stop_on_copy&format=rss).

## ບັນທຶກການປ່ຽນແປງ

#### 1.0.0

 * Initial release

## ຂໍ້ມູນກຳກັບ (Meta)

 *  ເວີຊັນ **1.0.0**
 *  ອັບເດດຫຼ້າສຸດເມື່ອ **11 ປີ ທີ່ຜ່ານມາ** ທີ່ຜ່ານມາ
 *  ການຕິດຕັ້ງທີ່ໃຊ້ງານຢູ່ **10+**
 *  ເວີຊັນ WordPress ** 2.5 ຫຼື ສູງກວ່າ **
 *  ທົດສອບເຖິງເວີຊັນ **4.3.0**
 *  ພາສາ
 * [English (US)](https://wordpress.org/plugins/shortcode-callback/)
 * ແທັກ
 * [bbcode](https://lo.wordpress.org/plugins/tags/bbcode/)[callback](https://lo.wordpress.org/plugins/tags/callback/)
   [php](https://lo.wordpress.org/plugins/tags/php/)[short code](https://lo.wordpress.org/plugins/tags/short-code/)
   [shortcode](https://lo.wordpress.org/plugins/tags/shortcode/)
 *  [ມຸມມອງຂັ້ນສູງ](https://lo.wordpress.org/plugins/shortcode-callback/advanced/)

## ການໃຫ້ຄະແນນ

 5 ຈາກທັງໝົດ 5 ດາວ.

 *  [  ການວິຈານ 5 ດາວ ຈຳນວນ 1 ລາຍການ     ](https://wordpress.org/support/plugin/shortcode-callback/reviews/?filter=5)
 *  [  ການວິຈານ 4 ດາວ ຈຳນວນ 0 ລາຍການ     ](https://wordpress.org/support/plugin/shortcode-callback/reviews/?filter=4)
 *  [  ການວິຈານ 3 ດາວ ຈຳນວນ 0 ລາຍການ     ](https://wordpress.org/support/plugin/shortcode-callback/reviews/?filter=3)
 *  [  ການວິຈານ 2 ດາວ ຈຳນວນ 0 ລາຍການ     ](https://wordpress.org/support/plugin/shortcode-callback/reviews/?filter=2)
 *  [  ການວິຈານ 1 ດາວ ຈຳນວນ 0 ລາຍການ     ](https://wordpress.org/support/plugin/shortcode-callback/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/shortcode-callback/reviews/#new-post)

[ເບິ່ງ ຄຳຄິດເຫັນ ທັງໝົດ](https://wordpress.org/support/plugin/shortcode-callback/reviews/)

## ຜູ້ຮ່ວມພັດທະນາ

 *   [ digitalpoint ](https://profiles.wordpress.org/digitalpoint/)

## ການຊ່ວຍເຫຼືອ

ມີຄຳຖາມ ຫຼື ຕ້ອງການຄວາມຊ່ວຍເຫຼືອບໍ່?

 [ເບິ່ງຟໍຣັມການຊ່ວຍເຫຼືອ](https://wordpress.org/support/plugin/shortcode-callback/)

## ບໍລິຈາກ

ເຈົ້າຕ້ອງການສະໜັບສະໜູນການພັດທະນາຂອງປລັກອິນນີ້ບໍ່?

 [ ບໍລິຈາກໃຫ້ປລັກອິນນີ້ ](https://marketplace.digitalpoint.com/shortcode-callback.3383/item#utm_source=readme&utm_medium=wordpress&utm_campaign=plugin)