Issues with open graph protocol

Discussion in 'WordPress' started by Purple Ninja, Feb 28, 2012.

  1. #1
    i have this code on my header of my theme
    <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php bloginfo('text_direction'); ?>" xml:lang="<?php bloginfo('language'); ?>" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#">
        <!-- Facebook Opengraph -->
        <meta property="fb:app_id" content="app_id" />
        <meta property="fb:admins" content="admins" />
        <meta property="og:locale" content="en_US" />
        <meta property="og:url" content="<?php the_permalink() ?>" />
    <?php if (is_single()) { ?>
        <meta property="og:title" content="<?php single_post_title(''); ?>" />
        <meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
        <meta property="og:type" content="article" />
        <?php foreach (get_representative_images() as $image_url): ?>
    <meta property="og:image" content="<?php echo $image_url ?>" />
    <?php endforeach; ?>
    <?php } else { ?>
        <meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
        <meta property="og:description" content="<?php bloginfo('description'); ?>" />
        <meta property="og:type" content="website" />
        <meta property="og:image" content="http://www.mysite.com/logo.png" />
    <?php } ?>
    Code (markup):
    and in function of theme this:
    function get_representative_images() {
        global $post;
        $images = array('http://www.mysite.com/logo.png');
        if ( has_post_thumbnail($post->ID) ) { // check if the post has a Post Thumbnail assigned to it.
            $image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail');
            array_unshift($images, $image_url[0]);
        }
        return $images;
    }
    Code (markup):
    in debugger it shows that everything is okay, but,
    1.when I test a URL from some post it gives 2 photo options (the logo and the thumbnail). What do I have to change in the code in order when it finds a thumbnail in a post to show me only the thumbnail and when it doesn't find the thumbnail of the post then it will show as an option only the logo?
    2. I noticed that in my text in expert, when there are "" & «» the text stops till the point it shows these when someone makes a "like" or "share" in a post. How can I make it to show the whole text that I have in the expert?
     
    Purple Ninja, Feb 28, 2012 IP
  2. Purple Ninja

    Purple Ninja Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    any help plz?
     
    Purple Ninja, Mar 1, 2012 IP
  3. Purple Ninja

    Purple Ninja Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Any news???
     
    Purple Ninja, Apr 2, 2012 IP
  4. dook12

    dook12 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    nothing new :D
     
    dook12, Apr 2, 2012 IP