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

Version Description

  • Fix in order to be compatible with "Business Directory Plugin" 3.0
Download this release

Release Info

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

Code changes from version 0.5.3 to 0.5.4

Files changed (2) hide show
  1. readme.txt +5 -1
  2. wonderm00n-open-graph.php +14 -4
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.1
7
- Stable tag: 0.5.3
8
 
9
  This plugin inserts Facebook Open Graph Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
  It also allows you to add the Meta Description tag and Schema.org Name, Description and Image tags for more effective Google+ sharing results.
@@ -50,6 +50,10 @@ Other Tags:
50
 
51
  == Changelog ==
52
 
 
 
 
 
53
  = 0.5.3 =
54
 
55
  * Minor fix to avoid php notices filling up error logs. Thanks to @flynsarmy (yet again).
4
  Tags: facebook, open graph, seo, share, social, meta
5
  Requires at least: 3
6
  Tested up to: 3.5.1
7
+ Stable tag: 0.5.4
8
 
9
  This plugin inserts Facebook Open Graph Tags into your WordPress Blog/Website for more effective Facebook sharing results.
10
  It also allows you to add the Meta Description tag and Schema.org Name, Description and Image tags for more effective Google+ sharing results.
50
 
51
  == Changelog ==
52
 
53
+ = 0.5.4 =
54
+
55
+ * Fix in order to be compatible with "Business Directory Plugin" 3.0
56
+
57
  = 0.5.3 =
58
 
59
  * Minor fix to avoid php notices filling up error logs. Thanks to @flynsarmy (yet again).
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.5.3
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 more effective Facebook sharing results. It also allows you to add the Meta Description tag and Schema.org Name, Description and Image tags for more effective Google+ sharing results. You can also choose to insert the "enclosure" and "media:content" tags to the RSS feeds, so that apps like RSS Graffiti and twitterfeed post the image to Facebook correctly.
10
  Author: Marco Almeida (Wonderm00n)
11
- Version: 0.5.3
12
  Author URI: http://wonderm00n.com
13
  */
14
 
15
- $wonderm00n_open_graph_plugin_version='0.5.3';
16
  $wonderm00n_open_graph_plugin_settings=array(
17
  'fb_app_id_show',
18
  'fb_app_id',
@@ -61,6 +61,9 @@ function wonderm00n_open_graph() {
61
  $$key=get_option('wonderm00n_open_graph_'.$key);
62
  }
63
 
 
 
 
64
  $fb_type='article';
65
  if (is_singular()) {
66
  //It's a Post or a Page or an attachment page - It acan also be the homepage if it's set as a page
@@ -105,13 +108,16 @@ function wonderm00n_open_graph() {
105
  if ($fb_show_businessdirectoryplugin==1) {
106
  @include_once(ABSPATH . 'wp-admin/includes/plugin.php');
107
  if (is_plugin_active('business-directory-plugin/wpbusdirman.php')) {
108
- $bdpaction = _wpbdp_current_action();
 
 
109
  switch($bdpaction) {
110
  case 'showlisting':
111
  //Listing
112
  $listing_id = get_query_var('listing') ? wpbdp_get_post_by_slug(get_query_var('listing'))->ID : wpbdp_getv($_GET, 'id', get_query_var('id'));
113
  $bdppost=get_post($listing_id);
114
  $fb_title=esc_attr(strip_tags(stripslashes($bdppost->post_title))).' - '.$fb_title;
 
115
  $fb_url=get_permalink($listing_id);
116
  if (trim($bdppost->post_excerpt)!='') {
117
  //If there's an excerpt that's what we'll use
@@ -143,6 +149,7 @@ function wonderm00n_open_graph() {
143
  //Categories
144
  $term = get_term_by('slug', get_query_var('category'), wpbdp_categories_taxonomy());
145
  $fb_title=esc_attr(strip_tags(stripslashes($term->name))).' - '.$fb_title;
 
146
  $fb_url=get_term_link($term);
147
  if (trim($term->description)!='') {
148
  $fb_desc=trim($term->description);
@@ -243,6 +250,9 @@ function wonderm00n_open_graph() {
243
  ';
244
  if (intval($fb_title_show)==1) $html.='<meta property="og:title" content="'.trim($fb_title).'" />
245
  ';
 
 
 
246
  if (intval($fb_title_show_schema)==1) $html.='<meta itemprop="name" content="'.trim($fb_title).'" />
247
  ';
248
  if (intval($fb_url_show)==1) {
1
  <?php
2
  /**
3
  * @package Wonderm00n's Simple Facebook Open Graph Meta Tags
4
+ * @version 0.5.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 more effective Facebook sharing results. It also allows you to add the Meta Description tag and Schema.org Name, Description and Image tags for more effective Google+ sharing results. You can also choose to insert the "enclosure" and "media:content" tags to the RSS feeds, so that apps like RSS Graffiti and twitterfeed post the image to Facebook correctly.
10
  Author: Marco Almeida (Wonderm00n)
11
+ Version: 0.5.4
12
  Author URI: http://wonderm00n.com
13
  */
14
 
15
+ $wonderm00n_open_graph_plugin_version='0.5.4';
16
  $wonderm00n_open_graph_plugin_settings=array(
17
  'fb_app_id_show',
18
  'fb_app_id',
61
  $$key=get_option('wonderm00n_open_graph_'.$key);
62
  }
63
 
64
+ //Also set Title Tag?
65
+ $fb_set_title_tag=0;
66
+
67
  $fb_type='article';
68
  if (is_singular()) {
69
  //It's a Post or a Page or an attachment page - It acan also be the homepage if it's set as a page
108
  if ($fb_show_businessdirectoryplugin==1) {
109
  @include_once(ABSPATH . 'wp-admin/includes/plugin.php');
110
  if (is_plugin_active('business-directory-plugin/wpbusdirman.php')) {
111
+ global $wpbdp;
112
+ //$bdpaction = _wpbdp_current_action();
113
+ $bdpaction=$wpbdp->controller->get_current_action();
114
  switch($bdpaction) {
115
  case 'showlisting':
116
  //Listing
117
  $listing_id = get_query_var('listing') ? wpbdp_get_post_by_slug(get_query_var('listing'))->ID : wpbdp_getv($_GET, 'id', get_query_var('id'));
118
  $bdppost=get_post($listing_id);
119
  $fb_title=esc_attr(strip_tags(stripslashes($bdppost->post_title))).' - '.$fb_title;
120
+ $fb_set_title_tag=1;
121
  $fb_url=get_permalink($listing_id);
122
  if (trim($bdppost->post_excerpt)!='') {
123
  //If there's an excerpt that's what we'll use
149
  //Categories
150
  $term = get_term_by('slug', get_query_var('category'), wpbdp_categories_taxonomy());
151
  $fb_title=esc_attr(strip_tags(stripslashes($term->name))).' - '.$fb_title;
152
+ $fb_set_title_tag=1;
153
  $fb_url=get_term_link($term);
154
  if (trim($term->description)!='') {
155
  $fb_desc=trim($term->description);
250
  ';
251
  if (intval($fb_title_show)==1) $html.='<meta property="og:title" content="'.trim($fb_title).'" />
252
  ';
253
+ if (intval($fb_set_title_tag)==1) {
254
+ //Does nothing so far. We try to create the <title> tag but it's too late now
255
+ }
256
  if (intval($fb_title_show_schema)==1) $html.='<meta itemprop="name" content="'.trim($fb_title).'" />
257
  ';
258
  if (intval($fb_url_show)==1) {