• Resolved Alexis Wilke

    (@alexiswilke)


    I setup my website with twentyseventeen where I added a few tweaks of my own, but your plugin works on all other pages, so I suspect there is something that prevents your plugin from doing its thing properly in this specific case.

    So… I went to “Appearance » Customize” and clicked on “Static Front Page”.

    Here I put a static page as the front page and another static page using path “/blog” as my blog page (with the new posts appearing on that page as expected–the content of the static page are ignored except the path and title.) The “Static Front Page” allows for both those selections to be made there.

    The “/blog” static page has a featured image and just in case, I also filled the OG Graph info.

    Note the fact that the “/blog” page does not show the featured image. I am thinking that this is the reason your plugin fails (i.e. somehow the theme or WP Core prevent the use of the featured image on that page.)

    There is a link to said page:

    https://diverserealty.team/blog/

    There is a screenshot of Firebug showing that the “og:image” tag is missing.

    https://diverserealty.team/wp-content/uploads/2015/12/20171031-og-graph-bug-missing-image-url.png

    Here I show that I selected a featured image and put its link in your form. Even having the link in your form did not help.

    https://diverserealty.team/wp-content/uploads/2015/12/20171031-og-graph-bug-selection.png

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi there @alexiswilke

    Have you set up a default image in the plugin settings? If yes, does that image shows up as og:image?

    The way the plugin works (until 2.1.6.1), when a page is set as blog page, is using the default image set on the plugin settings page.

    We will change this behavior on 2.1.6.2

    Please get back to us on this.

    Thread Starter Alexis Wilke

    (@alexiswilke)

    @webdados Not too sure what’s happening here.

    The front page now shows my /blog page featured image. As I mentioned, it could be a theme side effect and not really your doing.

    Anyway, for the “On Post/Page, use image from: …” settings, I have (1), (2), (5) selected (so (2) and (3) are unchecked.)

    With a default image I see the default image on the home page but not on the /blog which now uses the latest post image instead. That in itself is not too bad, even though that’s not exactly what I’d like.

    The /blog page has a default image that looks like a journal and that would not change through time. With the latest post, depending on when you post the page to Facebook, that image will be stuck in Facebook/Twitter caches… not the best solution. And I cannot be sure it won’t change over time so trying to get the journal image stuck there would probably not work.

    What surprises me the most, though, is that the image I specifically specify in the page as the og:image is not being used.

    i.e. what I show on this screenshot:

    https://diverserealty.team/wp-content/uploads/2015/12/20171031-og-graph-bug-selection.png

    Have you tried the most recent version?

    It fixes this: “What surprises me the most, though, is that the image I specifically specify in the page as the og:image is not being used.”

    Thread Starter Alexis Wilke

    (@alexiswilke)

    @webdados,

    Yes, my last testing was with Version 2.1.6.3 and it still happens. I tend to quickly upgrade all my plugins. Just in case there would be some security fix in the upgrade.

    I’m guessing that, on your blog, the $post variable is being overwritten somehow by the latest post of that page, which is odd because in the moment we check for it, it should be the blog page https://plugins.trac.wordpress.org/browser/wonderm00ns-simple-facebook-open-graph-tags/trunk/public/class-webdados-fb-open-graph-public.php#L329

    Then, when we go for the image https://plugins.trac.wordpress.org/browser/wonderm00ns-simple-facebook-open-graph-tags/trunk/public/class-webdados-fb-open-graph-public.php#L340 we have the wrong one.

    I’ve just tried it here on a clean install and the Twenty Seventeen theme and it gets the image from the blog page featured image, or the field from our metabox.

    Can you please try to var_dump the $post->ID after https://plugins.trac.wordpress.org/browser/wonderm00ns-simple-facebook-open-graph-tags/trunk/public/class-webdados-fb-open-graph-public.php#L329 and confirm if you’re getting the page ID or the latest post ID?

    Some plugin or custom code is probably messing with this.

    Thread Starter Alexis Wilke

    (@alexiswilke)

    I tested with a brand new installation. Absolutely no other plugin, I just installed yours.

    I created a blog page /blog/ and assigned it as the blog page.

    Went to it and looked at the $post parameter using var_dump(). It shows me the first post. I also tested that on my website for which I reported the problem.

    It clearly says I have the latest and the 2017 theme…

    “WordPress 4.9.1 running Twenty Seventeen theme.”

    Now, if I change the global $post with the following code:

    $post = $wp_query->get_queried_object();

    And when necessary (one place) I added global $wp_query, and then it works as expected.

    For example, around line 329, it becomes like this:

    if ( is_home() ) {
    //global $post;
    $post = $wp_query->get_queried_object();

    Although just that does not fix the og:image. The get_post_image() function needs it too (line 710).

    And you have it at line 102 as well. Then it all works as expected. Home page, Blog Page, Pages of the Blog.

    I’ve fixed it using a similar approach to what you suggested.

    On line 102 there’s no need to make any changes because we’re inside is_singular() which is true for “homepage set as page” but not for the blog page.

    It will be fixed on 2.2

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘og:image missing on /blog’ is closed to new replies.