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

Version Description

  • "Business Directory Plugin" plugin integration. It's now possible to populate "og:title", "og:url", "og:description" and "og:image" tags with each listing details. If a featured image is set it will be used. If not, the listing main image is used.
Download this release

Release Info

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

Code changes from version 0.3.5 to 0.4

includes/settings-page.php CHANGED
@@ -37,6 +37,7 @@
37
  update_option('wonderm00n_open_graph_fb_image_use_media', intval($_POST['fb_image_use_media']));
38
  update_option('wonderm00n_open_graph_fb_image_use_default', intval($_POST['fb_image_use_default']));
39
  update_option('wonderm00n_open_graph_fb_show_subheading', intval($_POST['fb_show_subheading']));
 
40
  }
41
  }
42
 
@@ -307,7 +308,21 @@
307
  <tr>
308
  <th scope="row" nowrap="nowrap">Add SubHeading to Post/Page title?</th>
309
  <td>
310
- <input type="checkbox" name="fb_show_subheading" id="fb_show_subheading" value="1" <?php echo (intval($fb_show_subheading)==1 ? ' checked="checked"' : ''); ?> onclick="showAppidOptions();"/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  </td>
312
  </tr>
313
  </table>
@@ -319,6 +334,7 @@
319
  <p>This plugin is currently compatible with:</p>
320
  <ul>
321
  <li><a href="http://wordpress.org/extend/plugins/subheading/" target="_blank">SubHeading</a></li>
 
322
  </ul>
323
  <?php
324
  }
37
  update_option('wonderm00n_open_graph_fb_image_use_media', intval($_POST['fb_image_use_media']));
38
  update_option('wonderm00n_open_graph_fb_image_use_default', intval($_POST['fb_image_use_default']));
39
  update_option('wonderm00n_open_graph_fb_show_subheading', intval($_POST['fb_show_subheading']));
40
+ update_option('wonderm00n_open_graph_fb_show_businessdirectoryplugin', intval($_POST['fb_show_businessdirectoryplugin']));
41
  }
42
  }
43
 
308
  <tr>
309
  <th scope="row" nowrap="nowrap">Add SubHeading to Post/Page title?</th>
310
  <td>
311
+ <input type="checkbox" name="fb_show_subheading" id="fb_show_subheading" value="1" <?php echo (intval($fb_show_subheading)==1 ? ' checked="checked"' : ''); ?>/>
312
+ </td>
313
+ </tr>
314
+ </table>
315
+ <?php
316
+ }
317
+ if(is_plugin_active('business-directory-plugin/wpbusdirman.php')) {
318
+ $thirdparty=true;
319
+ ?>
320
+ <h4><a href="http://wordpress.org/extend/plugins/business-directory-plugin/" target="_blank">Business Directory Plugin</a></h4>
321
+ <table width="100%" class="form-table">
322
+ <tr>
323
+ <th scope="row" nowrap="nowrap">Use listing BDP listing contents as OG tags?</th>
324
+ <td>
325
+ <input type="checkbox" name="fb_show_businessdirectoryplugin" id="fb_show_businessdirectoryplugin" value="1" <?php echo (intval($fb_show_businessdirectoryplugin)==1 ? ' checked="checked"' : ''); ?>/>
326
  </td>
327
  </tr>
328
  </table>
334
  <p>This plugin is currently compatible with:</p>
335
  <ul>
336
  <li><a href="http://wordpress.org/extend/plugins/subheading/" target="_blank">SubHeading</a></li>
337
+ <li><a href="http://wordpress.org/extend/plugins/business-directory-plugin/" target="_blank">Business Directory Plugin</a></li>
338
  </ul>
339
  <?php
340
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://blog.wonderm00n.com/2011/10/14/wordpress-plugin-simple-faceb
4
  Tags: facebook, open graph, seo, share, social, meta
5
  Requires at least: 3
6
  Tested up to: 3.5
7
- Stable tag: 0.3.5
8
 
9
  This plugin inserts Facebook Open Graph Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
 
@@ -35,6 +35,10 @@ The tags that this plugin inserts are:
35
 
36
  == Changelog ==
37
 
 
 
 
 
38
  = 0.3.5 =
39
 
40
  * Minor fixes to avoid php notices filling up error logs. Thanks to flynsarmy.
4
  Tags: facebook, open graph, seo, share, social, meta
5
  Requires at least: 3
6
  Tested up to: 3.5
7
+ Stable tag: 0.4
8
 
9
  This plugin inserts Facebook Open Graph Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
 
35
 
36
  == Changelog ==
37
 
38
+ = 0.4 =
39
+
40
+ * "Business Directory Plugin" plugin integration. It's now possible to populate "og:title", "og:url", "og:description" and "og:image" tags with each listing details. If a featured image is set it will be used. If not, the listing main image is used.
41
+
42
  = 0.3.5 =
43
 
44
  * Minor fixes to avoid php notices filling up error logs. Thanks to flynsarmy.
wonderm00n-open-graph.php CHANGED
@@ -1,18 +1,18 @@
1
  <?php
2
  /**
3
  * @package Wonderm00n's Simple Facebook Open Graph Meta Tags
4
- * @version 0.3.5
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)
11
- Version: 0.3.5
12
  Author URI: http://wonderm00n.com
13
  */
14
 
15
- $wonderm00n_open_graph_plugin_version='0.3.5';
16
  $wonderm00n_open_graph_plugin_settings=array(
17
  'fb_app_id_show',
18
  'fb_app_id',
@@ -37,7 +37,8 @@ $wonderm00n_open_graph_plugin_settings=array(
37
  'fb_image_use_content',
38
  'fb_image_use_media',
39
  'fb_image_use_default',
40
- 'fb_show_subheading'
 
41
  );
42
 
43
  function wonderm00n_open_graph() {
@@ -111,6 +112,54 @@ function wonderm00n_open_graph() {
111
  if (intval($fb_image_show)==1) {
112
  $fb_image=wonderm00n_open_graph_post_image($fb_image_use_featured, $fb_image_use_content, $fb_image_use_media, $fb_image_use_default, $fb_image);
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  } else {
115
  global $wp_query;
116
  //Other pages - Defaults
1
  <?php
2
  /**
3
  * @package Wonderm00n's Simple Facebook Open Graph Meta Tags
4
+ * @version 0.4
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)
11
+ Version: 0.4
12
  Author URI: http://wonderm00n.com
13
  */
14
 
15
+ $wonderm00n_open_graph_plugin_version='0.4';
16
  $wonderm00n_open_graph_plugin_settings=array(
17
  'fb_app_id_show',
18
  'fb_app_id',
37
  'fb_image_use_content',
38
  'fb_image_use_media',
39
  'fb_image_use_default',
40
+ 'fb_show_subheading',
41
+ 'fb_show_businessdirectoryplugin'
42
  );
43
 
44
  function wonderm00n_open_graph() {
112
  if (intval($fb_image_show)==1) {
113
  $fb_image=wonderm00n_open_graph_post_image($fb_image_use_featured, $fb_image_use_content, $fb_image_use_media, $fb_image_use_default, $fb_image);
114
  }
115
+ //Business Directory Plugin
116
+ if ($fb_show_businessdirectoryplugin==1) {
117
+ @include_once(ABSPATH . 'wp-admin/includes/plugin.php');
118
+ if (is_plugin_active('business-directory-plugin/wpbusdirman.php')) {
119
+ $bdpaction = _wpbdp_current_action();
120
+ switch($bdpaction) {
121
+ case 'showlisting':
122
+ //Listing
123
+ $listing_id = get_query_var('listing') ? wpbdp_get_post_by_slug(get_query_var('listing'))->ID : wpbdp_getv($_GET, 'id', get_query_var('id'));
124
+ $bdppost=get_post($listing_id);
125
+ $fb_title=esc_attr(strip_tags(stripslashes($bdppost->post_title))).' - '.$fb_title;
126
+ $fb_url=get_permalink($listing_id);
127
+ if (trim($bdppost->post_excerpt)!='') {
128
+ //If there's an excerpt that's waht we'll use
129
+ $fb_desc=trim($bdppost->post_excerpt);
130
+ } else {
131
+ //If not we grab it from the content
132
+ $fb_desc=trim($bdppost->post_content);
133
+ }
134
+ $fb_desc=(intval($fb_desc_chars)>0 ? substr(esc_attr(strip_tags(strip_shortcodes(stripslashes($fb_desc)))),0,$fb_desc_chars) : esc_attr(strip_tags(strip_shortcodes(stripslashes($fb_desc)))));
135
+ if (intval($fb_image_show)==1) {
136
+ $thumbdone=false;
137
+ if (intval($fb_image_use_featured)==1) {
138
+ //Featured
139
+ if ($id_attachment=get_post_thumbnail_id($bdppost->ID)) {
140
+ //There's a featured/thumbnail image for this listing
141
+ $fb_image=wp_get_attachment_url($id_attachment, false);
142
+ $thumbdone=true;
143
+ }
144
+ }
145
+ if (!$thumbdone) {
146
+ //Main image loaded
147
+ if ($thumbnail_id = wpbdp_listings_api()->get_thumbnail_id($bdppost->ID)) {
148
+ $fb_image=wp_get_attachment_url($thumbnail_id, false);
149
+ }
150
+ }
151
+ }
152
+ break;
153
+ case 'main':
154
+ //Main page
155
+ //No changes
156
+ break;
157
+ default:
158
+ //No changes
159
+ break;
160
+ }
161
+ }
162
+ }
163
  } else {
164
  global $wp_query;
165
  //Other pages - Defaults