ThemeShaper Forums » Thematic

[closed]

widget_text do_shortcode (how to move widget action to functions.php)?

(1 post)
  • Started 3 years ago by acts7
  • This topic is not resolved
  1. acts7
    Member

    This is related to Viper Video QuickTag but its a general question of conversion related to WordPress and Thematic.
    This is the code that is called in the plugin.
    [code]
    add_filter( 'widget_text', 'do_shortcode', 11 ); // Videos in the text widget
    add_action( 'widget_text', array(&$this, 'SWFObjectCalls'), 50 );
    [/code]
    The SWFObjectCalls function is what writes out the swfobject.embedswf code.
    I’m having issue in that I don’t get the swfobject.embedSWF script unless I add an empty text widget.
    I am almost certain this is due to the “widget_text” filter used to do the shortcode.

    How can I activate the do_shortcode in the sidebar without using a widget?
    And instead activate it from my functions.php file?

    [code]
    // ... before this is my query to get post with category "video" ...
    // GET CUSTOM FIELD VALUE
    $videoshortcode = get_post_custom_values($key = 'VideoShortcode');
    // GET FIRST in array in case more than one exist
    $videoshort = $videoshortcode[0];
    // CHECK THAT SHORTCODE EXISTS
    if(isset($videoshort) && strcmp($videoshort,'')!= 0) {

    // DO THE SHORTCODE
    echo do_shortcode($videoshort);
    }
    [/code]

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.