Biranit
Forum Replies Created
-
Hi sewpafly,
I enabled debuggin, but clicking on the red “Debug” tab does nothing other than to reload that thickbox in the same “loading” state. It doesn’t display any log or anything.
I’m on Firefox 8.0.1. I just tried it on Chrome (latest version) and got the same result.
Thanks,
Bira
Hi Chris,
First off, thanks for the credit in the changelog. I was floored seeing my name there! ??
A couple issues with this fix, though:
1) you applied the fix (of changing next_post to the_post) to the function live_blogging_shortcode where, in fact, this was never an issue (at least not for me), because the autoembeding and other shortcodes were parsed _after_ the [liveblog] shortcode was parsed. But, I suppose it makes no harm really to have it done there too.
However, you did not apply this fix to the function live_blogging_ajax – where I ran into the issue (I use polling). (It could also be implemented in the function live_blog_chatbox_get_posts)
2) Just a suggestion: you don’t really need to store $post in an interim variable. It’s enough that you add wp_reset_postdata(); after the custom query’s loop. This restores the previous $post variable to global, but with less code ??
while ($q->have_posts()) { $q->the_post(); $r[] = array( 'liveblog' => $liveblog_id, 'id' => $q->post->ID, 'type' => 'entry', 'html' => live_blogging_get_entry($q->post) ); } wp_reset_postdata();
Cheers!
Bira
Chris, just thought I’d give you a head’s up, in case anyone ever comes asking about this:
Some of my shortcodes were not working on live blogging, particularly the Blackbird Pie Twitter embed, which is actually a fantastic companion for live blogging.
I split hairs over this for three days, eventually discovering it wasn’t working because on the BBP plugin, it used if (!is_admin()) before doing add_shortcode and wp_embed_register_handler. And, since the polling uses admin-ajax.php, then obviously the is_admin() condition fails…
This has nothing to do with you, but I figured I’d let you know if someone comes asking why this-and-that isn’t working. Quite a few plugins that are geared towards frontend stuff use the !is_admin() condition, and obviously admin-ajax.php fails that. So it’s something worth keeing in mind ??
Cheers,
Bira
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…
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.
Chris: you’re awesome. Thank you ??
Sorry, Brad, I should clarify with regards to what to see here – https://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.
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: https://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()) { $q->the_post(); $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: https://pastebin.com/Z406tybF
Many thanks,
Bira
Nope, it does not. I did that change and evrything works flawlessly ??
OK, fair enough re the wrong link. But autoembed will not work with next_post exactly because you’re not setting the global post.
Give it a try yourself and see ??
OK, this took a LOT of investigative work and trials and errors ??
The problem is that autoembed does NOT work outside the loop. This is because it has to cache the result, or else it will need to query the embed source every time. So it has to run within the global $post.
CHRIS:
In your function live_blogging_ajax() you have a loop running, however you are using the deprecated function $q->next_post(). Changing this to $q->the_post() fixes the autoembed issue altogether, and everything works perfectly.Not sure exactly why you use next_post() (which is, as I noted, deprecated).
Cheers,
Bira
Hi Chris,
I have a feeling this has to do with the auto-embed now using the IFRAME version of youtube/vimeo/etc. It’s just a hunch.
I’ll keep investigating and let you know if I find the reason and/or the solution.
Cheers,
Bira
Forum: Fixing WordPress
In reply to: "Infinity" as values in selection in image croppingAdd me to the list of victims… Can someone perhaps give us some insight as to why this is happening?
Forum: Fixing WordPress
In reply to: get post ID using meta-key querySince the post is here, you might as well get the correct way of doing it ??
query_posts('meta_key=sky&meta_value=GS_5-00252'); if (have_posts()) : while (have_posts()) : the_post(); $str = get_the_ID() ; echo $str; endwhile; else : echo 'NO POST yet, create'; endif;
Forum: Fixing WordPress
In reply to: YouTube embed not working in 3.1Just to add another point: the problem appears to be in the oembed caching in the postmeta db table. It stores {{unknown}} as the meta_value.
I looked in media.php and compared it to previous versions. It appears the only or primary change was adding $post_ID to this:
return apply_filters( ’embed_oembed_html’, $cache, $url, $attr, $post_ID );
return apply_filters( ’embed_oembed_html’, $html, $url, $attr, $post_ID );Not sure if it’s related in any way, but it is definitely an issue with the postmeta cache value. If I delete the *_oembed_* entry from the wp_postmeta table for a post, then the video shows up again.
For now, I did a very dirty fix of adding an sql delete query to the top of my single.php file… Far from pretty or ideal… but at least the videos work again.