0

I'm using the Wordpress CMS. I don't have access to the theme's code etc..

So how do I update the opeh graph tags? I'm mainly looking to add an image to go along with it, as it's using the default WordPress image when I share on Facebook.

Thanks!

3
  • Not sure why I was down voted twice. I can't install plugins, so how do I update meta tags? Commented Mar 4, 2012 at 6:16
  • Flagged as »not constructive« This question is not a good fit to our Q&A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion.
    – kaiser
    Commented Mar 5, 2012 at 0:58
  • WordPress - Stack Exchange is for WordPress developers and administrators. If you cannot touch the code your question is probably off topic.
    – fuxia
    Commented Apr 7, 2012 at 21:22

2 Answers 2

1

Do you have access to (installing) plugins? There are several plugins that lets you add the Open Graph tags: http://wordpress.org/extend/plugins/search.php?q=open+graph

1
  • how do I install plugins? Commented Mar 4, 2012 at 6:16
0

Here's the way I did after finding a solution via google. This seems to work an pulls an image based on the featured image set on a post. If it is a main page or a post/page with no featured image, there is a conditional statement which allows you to set a static image.

<!-- facebook integration -->
<meta property="fb:app_id" content="YOUR FACEBOOK APP ID" />
<meta property="fb:admins" content="YOUR FACEBOOK ADMIN CODE" />
<?php if (is_single() || is_author()) { ?>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:url" content="<?php the_permalink() ?>"/>
<meta property="og:title" content="<?php wp_title(); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php if (function_exists('wp_get_attachment_thumb_url')) {echo wp_get_attachment_thumb_url(get_post_thumbnail_id($post->ID)); }?>" />
<?php } else { ?>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:url" content="<?php the_permalink() ?>"/>
<meta property="og:title" content="<?php wp_title(); ?>" />
<meta property="og:description" content="<?php bloginfo('description'); ?>" />
<meta property="og:type" content="website" />
<meta property="og:image" content="LINK TO IMAGE TO USE FOR THUMBNAIL HERE" /> <?php } ?>

Sorry, just noticed you said you didnt have access to the code. I guess a plugin is your only route. If you can get access to the header, you can try my code snippet above.

Yes, a plugin that can do it: http://wordpress.org/extend/plugins/facebook-open-graph-meta-in-wordpress/

And more info (another way of) doing this on this code route: http://www.wpbeginner.com/wp-themes/how-to-add-facebook-open-graph-meta-data-in-wordpress-themes/

1
  • Open Graph protocol is based on og: tags and does not need other tags to be correctly supported. Your example should not include fb: tags. This is something Facebook needs for completely different purpose. You don't need to provide your Facebook application ID and secret code in order to be able to post to Facebook using Open Graph.
    – trejder
    Commented Sep 15, 2015 at 11:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.