Support » Plugins and Hacks » Youtube shortcode » shortcode in ajax

shortcode in ajax

Viewing 2 replies - 1 through 2 (of 2 total)
  • // Constructor / initialize plugin
        function Youtube_shortcode()
            // Load our shortcode only on the frontend
            if ( !is_admin() || FALSE !== strpos($_SERVER['SCRIPT_NAME'], 'wp-admin'))
                // Is it a mobile phone?
                // Guess once host language (used for Youtube's old embed code = Flash only)
                // do_shortcode() is registered as a default filter on 'the_content' with a priority of 11.
                // To make videos appear on post excerpts follow this guide: http://bloggingsquared.com/blogging-tips/make-shortcodes-work-in-all-wordpress-post-excerpts/
                add_shortcode('youtube_sc', array($this, 'output_html'));
                add_action('wp_enqueue_scripts', array($this, 'output_css'));
            // Allow the button to appear on any rich text editor (i.e. text editor in a widget)
    		add_action('admin_init', array($this, 'setup_tinymce_button'));

    I also corrected this feature by
    * Check if WordPress is doing ajax or not. Helpful when testing for admin
    * templates because is_admin() will be true even though the user might not be
    * on admin, or even logged in.
    function is_ajax()
    return defined( ‘DOING_AJAX’ ) && DOING_AJAX;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘shortcode in ajax’ is closed to new replies.
Skip to toolbar