Open Graph for Facebook, Google+ and Twitter Card Tags - Version 0.1.2

Version Description

  • Fixing a bug for themes that do not support post thumbnail
Download this release

Release Info

Developer wonderm00n
Plugin Icon Open Graph for Facebook, Google+ and Twitter Card Tags
Version 0.1.2
Comparing to
See all releases

Code changes from version 0.1.1 to 0.1.2

includes/settings-page.php CHANGED
@@ -178,6 +178,10 @@
178
  $links[30]['url']='http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/';
179
  $links[40]['text']='Author\'s website: Marco Almeida (Wonderm00n)';
180
  $links[40]['url']='http://wonderm00n.com';
 
 
 
 
181
  ?>
182
  <div class="postbox-container" style="width: 29%;">
183
 
178
  $links[30]['url']='http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/';
179
  $links[40]['text']='Author\'s website: Marco Almeida (Wonderm00n)';
180
  $links[40]['url']='http://wonderm00n.com';
181
+ $links[50]['text']='Author\'s Twitter account: @Wonderm00n';
182
+ $links[50]['url']='http://twitter.com/wonderm00n';
183
+ $links[60]['text']='Author\'s Facebook account: Wonderm00n';
184
+ $links[60]['url']='http://www.facebook.com/wonderm00n';
185
  ?>
186
  <div class="postbox-container" style="width: 29%;">
187
 
readme.txt CHANGED
@@ -1,15 +1,17 @@
1
- === Plugin Name ===
2
  Contributors: wonderm00n
3
- Donate link: http://example.com/
4
- Tags: facebook, open graph, seo, share
5
  Requires at least: 3
6
  Tested up to: 3.2.1
7
- Stable tag: 0.1.1
8
 
9
  This plugin inserts Facebook Open Grpah Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
 
11
  == Description ==
12
 
 
 
13
  It allows the user to choose which tags are, or not, included and also the default image if the post/page doesn't have one.
14
 
15
  The tags that this plugin inserts are:
@@ -31,6 +33,10 @@ The tags that this plugin inserts are:
31
 
32
  == Changelog ==
33
 
 
 
 
 
34
  = 0.1.1 =
35
 
36
  * Adding Open Graph Namespace to the HTML tag
1
+ === Wonderm00n's Simple Facebook Open Graph Meta Tags ===
2
  Contributors: wonderm00n
3
+ Donate link: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/
4
+ Tags: facebook, open graph, seo, share, social, meta
5
  Requires at least: 3
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.1.2
8
 
9
  This plugin inserts Facebook Open Grpah Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
 
11
  == Description ==
12
 
13
+ This plugin inserts Facebook Open Grpah Tags into your WordPress Blog/Website for more effective Facebook sharing results.
14
+
15
  It allows the user to choose which tags are, or not, included and also the default image if the post/page doesn't have one.
16
 
17
  The tags that this plugin inserts are:
33
 
34
  == Changelog ==
35
 
36
+ = 0.1.2 =
37
+
38
+ * Fixing a bug for themes that do not support post thumbnail
39
+
40
  = 0.1.1 =
41
 
42
  * Adding Open Graph Namespace to the HTML tag
wonderm00n-open-graph.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /**
3
- * @package Wonderm00n's Simple Facebook Open Graph Tags
4
- * @version 0.1.1
5
  */
6
  /*
7
- Plugin Name: Wonderm00n's Simple Facebook Open Graph Tags
8
  Plugin URI: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/
9
  Description: This plugin inserts Facebook Open Graph Tags into your Wordpress Blog/Website for better Facebook sharing
10
  Author: Marco Almeida (Wonderm00n)
@@ -42,10 +42,19 @@ function wonderm00n_open_graph() {
42
  $fb_desc=trim($post->post_content);
43
  }
44
  $fb_desc=(intval($fb_desc_chars)>0 ? substr(esc_attr(strip_tags(stripslashes($fb_desc))),0,$fb_desc_chars) : esc_attr(strip_tags(stripslashes($fb_desc))));
45
- if ($id_attachment=get_post_thumbnail_id($post->ID)) {
46
- //There's a featured/thumbnail image for this post
47
- $fb_image=wp_get_attachment_url($id_attachment, false);
48
- } else {
 
 
 
 
 
 
 
 
 
49
  //If not, we'll try to get the first image on the post content
50
  $imgreg = '/<img .*src=["\']([^ ^"^\']*)["\']/';
51
  preg_match_all($imgreg, trim($post->post_content), $matches);
1
  <?php
2
  /**
3
+ * @package Wonderm00n's Simple Facebook Open Graph Meta Tags
4
+ * @version 0.1.2
5
  */
6
  /*
7
+ Plugin Name: Wonderm00n's Simple Facebook Open Graph Meta Tags
8
  Plugin URI: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-facebook-open-graph-tags/
9
  Description: This plugin inserts Facebook Open Graph Tags into your Wordpress Blog/Website for better Facebook sharing
10
  Author: Marco Almeida (Wonderm00n)
42
  $fb_desc=trim($post->post_content);
43
  }
44
  $fb_desc=(intval($fb_desc_chars)>0 ? substr(esc_attr(strip_tags(stripslashes($fb_desc))),0,$fb_desc_chars) : esc_attr(strip_tags(stripslashes($fb_desc))));
45
+ $thumbok=false;
46
+ if (function_exists('get_post_thumbnail_id')) {
47
+ $thumbok=true;
48
+ }
49
+ if ($thumbok) {
50
+ if ($id_attachment=get_post_thumbnail_id($post->ID)) {
51
+ //There's a featured/thumbnail image for this post
52
+ $fb_image=wp_get_attachment_url($id_attachment, false);
53
+ } else {
54
+ $thumbok=false;
55
+ }
56
+ }
57
+ if (!$thumbok) {
58
  //If not, we'll try to get the first image on the post content
59
  $imgreg = '/<img .*src=["\']([^ ^"^\']*)["\']/';
60
  preg_match_all($imgreg, trim($post->post_content), $matches);