Support » Plugin: PHP Code Widget » [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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’d like to know this too. shorthand & php are both necessary for me.

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

    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.