Title: [Plugin: PHP Code Widget] Is there a way to use shortcode?
Last modified: August 20, 2016

---

# [Plugin: PHP Code Widget] Is there a way to use shortcode?

 *  [crsneilhedley](https://wordpress.org/support/users/crsneilhedley/)
 * (@crsneilhedley)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-php-code-widget-is-there-a-way-to-use-shortcode/)
 * Trying to use shortcode from the WordPress-Amazon-Associate plugin. It generates
   the following for an album we reviewed:
 * [amazon_enhanced asin=”B00723NWJE” container=”” container_class=”” larger_image
   =”false” price=”New” background_color=”FFFFFF” link_color=”000000″ text_color
   =”0000FF” /]
 * If I put that in a sidebar TEXT/HTML widget, it displays properly. If I put it
   in the PHP/TEXT/HTML widget, it simply shows the shortcode.
 * I want to use the PHP widget so I generate the ASIN part of the shortcode dynamically.
   Is it possible?
 * [http://wordpress.org/extend/plugins/php-code-widget/](http://wordpress.org/extend/plugins/php-code-widget/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Skalders](https://wordpress.org/support/users/skalders/)
 * (@skalders)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-php-code-widget-is-there-a-way-to-use-shortcode/#post-2806529)
 * I’d like to know this too. shorthand & php are both necessary for me.
 *  [Skalders](https://wordpress.org/support/users/skalders/)
 * (@skalders)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-php-code-widget-is-there-a-way-to-use-shortcode/#post-2806530)
 * If anyone still wants to know, I have a solution.
    Instead of using this plugin,
   i made the default text widget support php code.
 * All you have to do is add this in your functions.php file:
 *     ```
       add_filter('widget_text', 'php_text', 99);
   
       function php_text($text) {
        if (strpos($text, '<' . '?') !== false) {
        ob_start();
        eval('?' . '>' . $text);
        $text = ob_get_contents();
        ob_end_clean();
        }
        return $text;
       }
       ```
   
 *  [robbieeeee](https://wordpress.org/support/users/robbieeeee/)
 * (@robbieeeee)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-php-code-widget-is-there-a-way-to-use-shortcode/#post-2806563)
 * Nice one Skalders 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: PHP Code Widget] Is there a way to use shortcode?’ is closed
to new replies.

 * ![](https://ps.w.org/php-code-widget/assets/icon.svg?rev=992095)
 * [PHP Code Widget](https://wordpress.org/plugins/php-code-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-widget/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [robbieeeee](https://wordpress.org/support/users/robbieeeee/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-php-code-widget-is-there-a-way-to-use-shortcode/#post-2806563)
 * Status: not resolved