GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   plugin that works for facebook comment/like thumbnails (https://gfy.com/showthread.php?t=1076481)

Jel 07-31-2012 10:44 AM

plugin that works for facebook comment/like thumbnails
 
tried a few and can't get any to work correctly - comment boxes/like buttons below wp posts appear obviously on fb, but with a totally random and unrelated thumbnail image. Anyone know of a plugin that actually pulls the image from the post liked/commented on?

fris 07-31-2012 07:25 PM

you could make it pull it from the useraccount, which uses gravatar, just a matter of doing a custom comment callback with a custom comment form

Jel 08-01-2012 02:33 AM

yeah thing is though I want it to pull the pic from the actual post. fb seems to want to pick whichever pic on the page is closest to it's 180x180 or whatever dimension it is. There are a couple plugins that say they use the post pic, or assigned thumbnail/featured image but they don't always (in fact hardly ever).

foxyflesh 08-01-2012 05:37 AM

<meta property="og:image" content="http://SITENAME/IMAGENAME" />

use that to tell facebook what image to use

fris 08-01-2012 07:57 AM

Quote:

Originally Posted by Jel (Post 19097065)
yeah thing is though I want it to pull the pic from the actual post. fb seems to want to pick whichever pic on the page is closest to it's 180x180 or whatever dimension it is. There are a couple plugins that say they use the post pic, or assigned thumbnail/featured image but they don't always (in fact hardly ever).

oh thouhgt you meant thumbs for users for comments, if you wanna just select the thumbnail do the meta tag for fb.

Jel 08-02-2012 09:28 AM

Quote:

Originally Posted by foxyflesh (Post 19097289)
<meta property="og:image" content="http://SITENAME/IMAGENAME" />

use that to tell facebook what image to use

that exact code? And where would I put that (if it is)? Seems that's a set image for the site as a whole? I want it to pull the specific pic from the specific post being shared/cpmmented on. Thanks :)

fris 08-02-2012 10:52 AM

Quote:

Originally Posted by Jel (Post 19099926)
that exact code? And where would I put that (if it is)? Seems that's a set image for the site as a whole? I want it to pull the specific pic from the specific post being shared/cpmmented on. Thanks :)

something like this in your functions.php file

Code:

function insert_image_src_rel_in_head() {
        global $post;
        if ( !is_singular()) //if it is not a post or a page
                return;
        if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
                $default_image="http://example.com/image.jpg"; //replace this with a default image on your server or an image in your media library
                echo '<meta property="og:image" content="' . $default_image . '"/>';
        }
        else{
                $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
                echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
        }
        echo "
";
}
add_action( 'wp_head', 'insert_image_src_rel_in_head', 5 );


Jel 08-03-2012 12:51 AM

nope, still just pulls a random image off the page ><


All times are GMT -7. The time now is 12:58 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc