The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Twitter Blackbird Pie
Shortcode and/or autoembed do not work in all ca (9 posts)

  1. Biranit
    Posted 4 years ago #


    I find this plugin very useful (although I have to admit I had to hack it a bit, to clean so expensive and unnecessary queries). Thank you for that.

    I'm rather stuck, though, on one point: the plugin doesn't work when using apply_filters('the_content' $content) - although other autoembeds (e.g. youtube) and shortcodes (eg [embed]) do work fine.

    Any suggestion?

    This is a very important issue for me, because we want to use this in conjunction with the live-blogging plugin.




  2. bradvin
    Plugin Author

    Posted 4 years ago #

    Hi Bira,
    Can you paste an example shortcode you are using that doesnt work. Or paste your altered code into pastebin and post the link here so I can see if your modifications did not stop it from working.


  3. Biranit
    Posted 4 years ago #

    Hi Brad,

    Thanks for answering.

    1) With regards to apply_filters('the_content', $content) not triggering BlackBird, you can actually see this in action here: http://toi.rgbmedia.co.il/223_live-blog-testing/

    - When you first open the page, the tweet (on hour 11:47) loads just fine (as does an autoembed of a YouTube video). However, once polled, the tweet reverts back to showing the shortcode (whereas the YouTube video autoembeds just fine).

    The polling code that triggers this is:

    // Build currently active posts
        $q = new WP_Query(array(
              'post_type' => 'liveblog_entry',
              'liveblog' => $liveblog_id,
              'posts_per_page' => -1,
              'orderby' => 'date',
              'order' => 'ASC'
        $r = array();
        while ($q->have_posts())
            $style = get_option('liveblogging_style');
        	$style = preg_replace('/\$DATE/', get_the_time(get_option('liveblogging_date_style'), $q->post->ID), $style);
        	$style = preg_replace('/\$CONTENT/', apply_filters('the_content', $q->post->post_content), $style);
            $r[] = array(
                    'liveblog' => $liveblog_id,
                    'id' => $q->post->ID,
                    'type' => 'entry',
                    'html' => $style

    I should point out that this happens no matter what I try to do:

    - I tried simply putting a link to a tweet (I tried both https: and http. Both with /#/ and without).

    - I tried a shortcode with id=""

    - I tried a shortcode with url=""

    All of the above behave the same: in a normal single.php load they show up just fine, but in the above costum query, using apply_filters('the_content'), they do not. This, as opposed to any other autoembed or shortcode (e.g. caption).

    2) My alterations to the blackbird-pie.php file has nothing to do with it, I only commented out everything that has to do with the wordpress users (as we don't use the wordpress users system anyway for authors); and changes to the design of the tweets. Nevertheless, you can see the full altered code here: http://pastebin.com/Z406tybF

    Many thanks,


  4. Biranit
    Posted 4 years ago #

    Sorry, Brad, I should clarify with regards to what to see here - http://toi.rgbmedia.co.il/223_live-blog-testing/ -

    First when the page is loaded, you'll see the tweet (on hour 11:47). Just look at that page - you'll see that after 30 seconds it will revert to a shortcode. This is when the data is polled (every 30 secs). Sorry that I wasn't clear initially.

  5. bradvin
    Plugin Author

    Posted 4 years ago #

    ah ok cool thanks for the detailed explanation. I think it has something to do with the fact that you are not setting the global $post but rather setting $q = ths_post(); - but this is a guess just from browsing your code and I have not tested this at all.

    try adding do_shortcode eg:

    $style = preg_replace('/\$CONTENT/', do_shortcode(apply_filters('the_content', $q->post->post_content)), $style);

  6. Biranit
    Posted 4 years ago #

    The_post actually does set the $post as a global variable.

    I did try do_shortcode and it didn't work either.

    I'm just so sad about this.

  7. bradvin
    Plugin Author

    Posted 4 years ago #

    sorry i misread your code as $q= not $q->

    blackbirdpie adds a standard shortcode, nothing weird or different, so I do not think this is a blackbirdpie issue.

    try get the content via get_the_content first before you apply_filters('the_content' on it eg.

    $content = get_the_content();
    $style = apply_filters('the_content', $content);

  8. Biranit
    Posted 4 years ago #

    Ha! I solved it! :)

    You have if !is_admin() before the add_shortcode and wp_embed_register_handler lines. Which means that when using admin-ajax.php - which is what is being used for the polling on the live blogging link I gave you - it does NOT utilize the shortcode or autoembed :)

    Any reason why you conditioned this two on !is_admin?

    In any event, wow, a huge weight off my shoulders...

  9. bradvin
    Plugin Author

    Posted 4 years ago #

    Hi Bira

    I have removed the check for isAdmin in version 0.5.2 which should solve your problem.

    thanks :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic