• Resolved joeborders

    (@joeborders)


    Hello! I was just wondering. Is there a way to make it so that when sharing a link to an ad, a thumbnail from the ad itself appears rather than the thumbnail used for the site as a whole?…..you know what I mean? Currently if I share the link for an ad, the preview image in facebook, email, etc. shows my site logo.
    Thank you! ^_^

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

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    it should be possible to do so, you would need to first enable the Featured images for Advert custom post types, you can do that by adding the code below in your theme functions.php file

    
    add_action("adverts_post_type", function( $args ) {
      $args["supports"][] = "thumbnail";
      return $args;
    } );
    

    Now if the Ad has a main image selected in the gallery and the image is big enough to be shared on Facebook then when trying to share the image should be used.

    The minimum required image sizes for Facebook you can find for example here https://sproutsocial.com/insights/social-media-image-sizes-guide/#facebook

    Thread Starter joeborders

    (@joeborders)

    hmm. That didn’t seem to do it. I tried the facebook debugger too and it didn’t fix it. Maybe I’m missing something? how do you make it so an ad “has a main image selected”? is that just the one that appears first and enlarged?

    Plugin Author Greg Winiarski

    (@gwin)

    While editing the Ad, in the Gallery hover over an image and click the edit (pencil) icon. It will open a new modal window, in this window check the “Use this image as main image” checkbox and click “Update Description” button.

    If you have done all of this and the image still does not show when sharing you can paste here a link to a page where you are having this problem i will take a look at it.

    Thread Starter joeborders

    (@joeborders)

    Woot! That fixed it! Thanks Greg ^_^

    Thread Starter joeborders

    (@joeborders)

    Ok, one more thing. Is there a way we could make it so that the image displayed as the main image in the listing automatically gets selected/set up as the main image?

    Plugin Author Greg Winiarski

    (@gwin)

    Yes, you can do that with Force Featured Image snippet https://github.com/simpliko/wpadverts-snippets/blob/master/force-featured-image/force-featured-image.php

    @christasca0 have you completed the steps listed in the above messages? Without more details, it is hard to tell what is causing a problem with the FB preview on your site.

    Thread Starter joeborders

    (@joeborders)

    Awesome! thanks Greg!….I don’t know how to use this….do I plug it into my functions.php?

    Plugin Author Greg Winiarski

    (@gwin)

    It is best to install the snippets as separate plugins, you can read how to do that at the bottom of the page here https://github.com/simpliko/wpadverts-snippets/

    Thread Starter joeborders

    (@joeborders)

    Hi Greg, I’m sorry, I’m a relative noob with all of this. I couldn’t figure out any of the instructions on that page.
    -I saved the raw file as a text .php
    -found the directory public_html/wp-content/plugins in cpanel
    -created a file there called force-featured-image.php
    -copied the content of the .php file to that
    ….it didn’t work…..did I do something wrong? does it have to be in a folder?…or somewhere in the wpadverts folder?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    it seems you are following the instructions correctly, after the last step have you went to the wp-admin / Plugins panel and activated the Force Featured Image plugin (it should be there on the list after creating a file)?

    If you did then was there some error? and if so then what the error message said?

    Thread Starter joeborders

    (@joeborders)

    ohhhhh. lol. no…I didn’t do that. I’ll try that later today and get back to you…..derp :-p

    Thread Starter joeborders

    (@joeborders)

    HAHA! it Worked! Thanks Greg! ^_^ ^_^ ^_^

    Do I still need this in the functions.php file?:
    add_action(“adverts_post_type”, function( $args ) {
    $args[“supports”][] = “thumbnail”;
    return $args;
    } );

    Plugin Author Greg Winiarski

    (@gwin)

    Ok great :).

    Yes, this line is still needed, without it the Yoast SEO will not pick a proper image when sharing an Advert on social media.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Can I set up individual ad preview images?’ is closed to new replies.