Kris Nelson
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How can i change protected params. XMLRPC.Thanks Hugo, like clevertechie said, it’s not easy finding info on how to make this work with the register_meta function.
For anyone else that this might help, one thing that tripped me up was using this for custom post types. I mistakenly thought I had to replace the first parameter (i.e. ‘post’) with my custom post type name, and when I did, I wasn’t getting the results I expected.
Once I switched it back to ‘post’, it worked like a charm.
Thanks Andrew.
I ended up moving away from the plugin/shortcode and instead moved the code into the functions.php file and made this a page template instead, thinking it would help.
But still no luck, $post->post_content was empty (no content from my page template code) by the time it was executed. My template code did also use the ‘the_content’ filter, so that’s probably why.
I only needed this for a single page on my site, so I ended up hacking the following into the 2.0.4 version of the plugin:
$content = $post->post_content;
if (strlen($content) == 0 && $post->ID == 272) {
$content = apply_filters( ‘the_content’, $post->post_content );
}Hardcoding the page ID and only executing this if there is no existing in the page using this template (in my case) protected this from being executed elsewhere. I might have looked an checking the page template (possible?) instead of the page id, but it was too late at night when I coded this.
Thanks for the reply.
This is still the best plugin I’ve used for open graph support, and I appreciate you guys putting this together and maintaining active support here at the forums.
All the best,
– KrisOkay, one last comment and then I’m moving onto something else for awhile…
I looked through the revisions of this plugin and found this code in 2.0.1 that was removed in 2.0.2:
// function to call first uploaded image in content function wpfbogp_find_images() { global $post, $posts; // Grab filtered content (so all shorttags are fired) and match first image $content = apply_filters( 'the_content', $post->post_content );In no way an expert here, but I suspect the plugins that were breaking in 2.0.1 were because their plugins were adding filters for ‘the_content’ and when you called it in this plugin, it fired for them at the wrong time, etc.
My plugin doesn’t add a filter for ‘the_content’, so I don’t know if that means I have to add one somehow or give up using a shortcode altogether. The OP says this code in 2.0.1 broke his plugin, he didn’t say whether or not your FB plugin would sucessfully pick up his images for og:image tags (which is my problem).
In my situation here – depending if I’m in the minority of users here – I can try to get away with using a page template rather than a plugin, so if that works and I’m the only one missing out on images rendered by shortcodes, I try to change things on my end instead.
Another finding here, if it helps.
Not sure if this is a valid test, but I added an echo statement to the wpfbogp_find_images() method and the same in the method my plugin’s shortcode uses, each to output an html comment.
When looking at the page source when it’s rendered, the debug html comments I added to the wpfbogp method are displayed higher on the page then the one my shortcode method uses.
My assumption here is that echo statements in plugins will be rendered in the output of the page when that line of code is executed, and not rendered within the context of the shortcode, etc., so if that’s assumption is wrong, then ignore this test.
Andrew, I had a question about this comment in the thread:
“We did add the feature to pull images from content after applying shortcodes, so we can pull more images.”
I’m writing a plugin that renders an image from a shortcode, but that’s not getting pulled into an og:image tag.
When I threw in debug code in “wpfbogp_find_images()” to inspect “$post->post_content”, the content at that point still had my shortcode in it and not the rendered html with the image tag my shortcode generates.
It could very well be possible something I’m doing wrong in my plugin, and I’m continuing to investigate that. But in the meantime, I was wondering if there was anything else beside that find images method I would want to check here?
Thanks in advance,
– KrisI don’t know if it’s related, but I think I’m fighting the same battle here.
I’m writing a plugin which supports a shortcode to render an image. When I use the FB debugger while running this plugin, that rendered image from my shortcode isn’t displayed.
When looking at this FB plugin briefly, I see that it’s using $post->post_content to scan for image tables, but while I’m troubleshooting, I’m seeing that post_content for my page is showing up with the shortcode and not the content rendered after the shortcode.
I realize your post is about featured images and post thumbnails, but I’m curious to know if the same fix for both yours and my issue might be similar.
I’ll keep poking around and if I come across anything useful, I’ll share it here.
Okay, forget I asked that question – I found out what those items meant.
What I ended up also finding was that the use of applying that filter in the sharing code used in Jetpack is spotty at best.
I’m able to update some of the Jetpack/sharedaddy code itself in my install, but odds are when the next update for Jetpack comes out, I’m screwed again.
I need to track down where I can log a bug for these to be fixed.
Hi Marcel, found this thread from your post at:
http://brimosoft.nl/2011/11/15/jetpack-sharedaddy-and-lazyest-gallery/Wanted to reply on that site, but the comments weren’t enabled.
Anyway, I’m in the same situation and about to try out the fix you proposed. I did have one question, though, about the last two parameters in your add_filter statement:
add_filter( ‘sharing_permalink’, ‘my_gallery_permalink’, 10, 2 );Are those 10 and 2 values just arbitrary, or do they have significance? I started poking around the ShareDaddy code but have yet to find where or how that sharing_permalink hook is defined to see if that shed some light here, but thought you might have figured it out already.
Thanks,
– Kris