chuckreynolds / WPFBOGP

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

Looking for feedback: Show fallback image if a featured image is found? #54

Closed chuckreynolds closed 9 years ago

chuckreynolds commented 9 years ago

Lately I've been considering not showing the fallback image if there's a featured image present. Thought is - if you have a featured image it's probably more important than a fallback image and because FB sometimes pulls the image array in different orders - the fallback gets shown sometimes when it should use the featured image.

Open to opinions here.

jjeaton commented 9 years ago

I completely agree with that.

I was about to open an issue to ask to have the fallback image loaded last, as this line reverses the array and it gets output first, which seems to result in it getting chosen more often than the other images.

I would suggest two changes:

Happy to submit a PR if it would help.

chuckreynolds commented 9 years ago

@jjeaton make sure you're looking at the develop branch. That's where all the new stuff is. Beta 2 is the official last tag but I've got a lot of stuff in there since. So.. look there. That array is currently fixed but re: this topic... thinking about taking the fallback out if a featured is found.

This also means I need to fix the featured issue I found and listed in #53

Technically it all works and nobody's ever complained but I could try and push that into this next main release or do it as a .1 after the fact. I'd really like to get this puppy out this weekend if I can. :+1:

chuckreynolds commented 9 years ago

Okay bear with me here. Sketched this out on my mirror (whiteboard alternative ;) Need to talk it through and add in proper wp code after.

NEW FLOW

IF forcefallbackimage checkbox is TRUE && fallback image is not empty {
-- echo meta og:image with fallback image url.
done.
ELSEIF is a post, page, or page_for_posts (blog run by a page in settings) && thumbnails are enabled && it has a thumbnail
-- echo meta og:image with featured image url.
done.
ELSEIF { 
  IF is post, page, or frontpage with page_on_front {
    -- run through the content and add to array
  } IF fallback image is not empty {
    -- add fallback image to bottom of array
  }
  test array and output the image array to meta og:image tag(s).
  else after all that shit - nothing is there then output <!-- no images found bro --> warning.
}

WHEW..... sound good?? cc @jjeaton I need a beer

chuckreynolds commented 9 years ago

first stab at this rewrite. more to go. in branch feature/images-overhaul line 160. https://github.com/chuckreynolds/WPFBOGP/commit/25f8fa114de2bc8302338edf07071b092efb991f#diff-c8cc0644f3623183b121b88dde0bae39R259

jjeaton commented 9 years ago

Your logic here looks sound to me.

chuckreynolds commented 9 years ago

2.3.0-beta.3 has it all inclusive. feel free to test: https://github.com/chuckreynolds/WPFBOGP/releases/tag/2.3.0-beta.3