Viewing 10 replies - 1 through 10 (of 10 total)
  • the link to the youtube video needs to have &feature=related at the end of it, or &feature=share ..etc.

    Thread Starter avrilious

    (@avrilious)

    hi frumph, could you be more specific, caz i am not an experienced user,
    what should i do step by step
    Thanks for ur answer

    Thread Starter avrilious

    (@avrilious)

    that site will have lots of traffic, so when someone shares the page i want him to be able to share it with the right thumbnail

    .. it means when you type in the youtube link, you make sure the &feature=share (or related) is at the end of it

    Thread Starter avrilious

    (@avrilious)

    that didnt help, i added what u told me
    https://www.youtube.com/watch?v=1AGBix7EwVE&feature=share
    then got the link for embed one,
    put it here
    http://stunnerz.gr/starxidiamol/

    and when i go to share it with the facebook share button,
    it shows only 1 image and not the one i want :<

    So you’re just putting it into a URL line and having WordPress create the player, yeah? .. Then the issue is really with the player oembed that WordPress is outputting ;/

    You can grab the actual thumbnail from the youtube site like this:

    http://img.youtube.com/vi/1AGBix7EwVE/1.jpg

    ^ the img. /vi/ is different then the 1.jpg can be 1.jpg or 2.jpg or 3.jpg

    You could do this ;/

    add_action('wp_head', 'opengraph_make_thumbnail_for_youtube');
    
    function opengraph_make_thumbnail_for_youtube() {
            global $post;
            if ($post) {
                $pattern = '/(?:youtube\.com\/(?:[^\/]+\/[^\/]+\/|(?:v|e(?:mbed)?)\/|[^#]*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i';
                preg_match($pattern, $post->post_content, $matches);
                $found_id = (isset($matches[1])) ? $matches[1] : false;
                if ($found_id) echo '<meta property="og:image" content="http://img.youtube.com/vi/'.$found_id.'/1.jpg" />'."\r\n";
            }
        }

    This is untested and written from memory, but what it’s concept is you can filter the post_content of the current post and have it as an action that ads the og:image for the thumbnail be placed into the wp_head of your site

    You would add this to your functions.php file

    EDIT: Better regex pattern

    tested -> works, only works for the first one found, can be adjusted with preg_match_all to find all of the occurrences then you just loop the $matches[1] array to echo out all found

    Or you could avoid all that and try this plugin out: http://wordpress.org/extend/plugins/facebook-and-digg-thumbnail-generator/

    I did solve this.. just toss that code I put in the box above into your functions.php file

    Thread Starter avrilious

    (@avrilious)

    what actually worked is,
    i installed ur plugin that u told me
    then i went to test if the share works, but it didnt
    then i put each link to debugger and tried to test again and wualla
    it worked…
    thanks m8

    As long as it works πŸ˜‰

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘facebook like and share’ is closed to new replies.