chuckreynolds / WPFBOGP

WordPress Open Graph plugin development
wordpress.org/plugins/wp-facebook-open-graph-protocol/
13 stars 19 forks source link

Fallback image shows up before the actual image (Bug?) #47

Closed tordans closed 9 years ago

tordans commented 9 years ago

I have the plugin configured in a way that it always adds the fallback image. Right now I see a behavior where the fallback image is the first image and the (for example) post-image is the second.

<meta property="og:image" content="https://asset1.betterplace.org/assets/default/og-image.betterplace.png"/>
<meta property="og:image" content="http://www.betterplace.org/c/ueber-uns/files/2014/05/generic-content-header_desktop-1024x448.jpg"/>

With this code Facebook takes the fallback as primary image. Screenshot: https://developers.facebook.com/tools/debug/og/object/ shows:

bildschirmfoto 2015-01-09 um 17 59 29

In the code, there is a place that manually changes the order of the array. So it looks like, the plugin should behave correctly already. See https://github.com/chuckreynolds/WPFBOGP/blob/master/wp-facebook-ogp.php#L188

Question:

Thanks

chuckreynolds commented 9 years ago

So first off... let me just say that FB changes stuff ALL THE TIME... I've changed that sort order twice now trying to appease the FB gods. lol. Technically the only real alternative is to only throw one image up to them but I thought that'd be bad for most people; and even then they don't always 'listen' to what OG tags tell them. I think the way it works now is, generally across the board, fine - the problem is how they seem to randomly choose what gets displayed on their end as default. Back in the day when I made this it was pretty straightforward and they displayed what you presented in code. These days FB makes so many changes and decisions regardless of what you tell them in code I tend to just ignore the random issues anymore because there's really nothing I/we can do about them and when they change again it sometimes just works out. I'm not into adding a sort order option in the settings... the point of the plugin was to be a drop-in and roll with little to no user touch needed. I could go super crazy and add all this functionality but at that point it's not the plugin I wanted to make.

chuckreynolds commented 9 years ago

ya. more support about it. https://wordpress.org/support/topic/plugin-fetches-default-image-even-with-ft-image-present We can flip the order again so the fallback goes last. that's the simple fix but I'd hate to add another option in there to do it. anymore the fallback image thing doesn't work well with it pulling content images too.

Perhaps the order should go...

  1. if Featured image
  2. if Fallback image
  3. content images

I'm shitty at arrays..and coding lol.. but.. it should do a better job of injecting items into the array because right now it's just appending them afaik. hence flipping the order puts the default at the top. cc @tordans

chuckreynolds commented 9 years ago

@tordans what would you think if I didn't display the default/fallback image if we have a featured image? If you set a featured it'll come first in the array - any images found in the body would come after that.

Was looking into array_splice for the default image to always insert it second, after the featured image, but thinking about it... I don't think a default image needs to be given if a featured is explicitly set. thoughts?

chuckreynolds commented 9 years ago

I'd say for now this is patched in 13a2ad460ce2773a8b1a6d373ce8b2aae8e94578

feel free to continue the discussion however