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

Version Description

  • Better SubHeading plugin compatibility (choose either to add it Before or After the title)
  • Description set the same value as the title if it's empty
  • Added the fb_og_type filter so that plugins or themes can override the Open Graph Type
Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

includes/settings-page.php CHANGED
@@ -64,6 +64,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
64
  $usersettings['fb_image_use_default']= intval(webdados_fb_open_graph_post('fb_image_use_default'));
65
  $usersettings['fb_show_wpseoyoast']= intval(webdados_fb_open_graph_post('fb_show_wpseoyoast'));
66
  $usersettings['fb_show_subheading']= intval(webdados_fb_open_graph_post('fb_show_subheading'));
 
67
  $usersettings['fb_show_businessdirectoryplugin']= intval(webdados_fb_open_graph_post('fb_show_businessdirectoryplugin'));
68
  $usersettings['fb_adv_force_local']= intval(webdados_fb_open_graph_post('fb_adv_force_local'));
69
  $usersettings['fb_adv_notify_fb']= intval(webdados_fb_open_graph_post('fb_adv_notify_fb'));
@@ -729,7 +730,16 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
729
  <tr>
730
  <th scope="row"><i class="dashicons-before dashicons-admin-site"></i><?php _e('Add SubHeading to Post/Page title', 'wd-fb-og');?></th>
731
  <td>
732
- <input type="checkbox" name="fb_show_subheading" id="fb_show_subheading" value="1" <?php echo (intval($fb_show_subheading)==1 ? ' checked="checked"' : ''); ?>/>
 
 
 
 
 
 
 
 
 
733
  </td>
734
  </tr>
735
  </table>
@@ -928,6 +938,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
928
  showDescriptionCustomText();
929
  showImageOptions();
930
  showFBNotifyOptions();
 
931
  });
932
  function showAppidOptions() {
933
  if (jQuery('#fb_app_id_show').is(':checked')) {
@@ -1046,6 +1057,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
1046
  jQuery('.fb_adv_notify_fb_options').hide();
1047
  }
1048
  }
 
 
 
 
 
 
 
1049
  </script>
1050
  <style type="text/css">
1051
  .og_left_col {
64
  $usersettings['fb_image_use_default']= intval(webdados_fb_open_graph_post('fb_image_use_default'));
65
  $usersettings['fb_show_wpseoyoast']= intval(webdados_fb_open_graph_post('fb_show_wpseoyoast'));
66
  $usersettings['fb_show_subheading']= intval(webdados_fb_open_graph_post('fb_show_subheading'));
67
+ $usersettings['fb_subheading_position']= trim(webdados_fb_open_graph_post('fb_subheading_position'));
68
  $usersettings['fb_show_businessdirectoryplugin']= intval(webdados_fb_open_graph_post('fb_show_businessdirectoryplugin'));
69
  $usersettings['fb_adv_force_local']= intval(webdados_fb_open_graph_post('fb_adv_force_local'));
70
  $usersettings['fb_adv_notify_fb']= intval(webdados_fb_open_graph_post('fb_adv_notify_fb'));
730
  <tr>
731
  <th scope="row"><i class="dashicons-before dashicons-admin-site"></i><?php _e('Add SubHeading to Post/Page title', 'wd-fb-og');?></th>
732
  <td>
733
+ <input type="checkbox" name="fb_show_subheading" id="fb_show_subheading" value="1" <?php echo (intval($fb_show_subheading)==1 ? ' checked="checked"' : ''); ?> onclick="showSubheadingOptions();"/>
734
+ </td>
735
+ </tr>
736
+ <tr class="fb_subheading_options">
737
+ <th scope="row"><i class="dashicons-before dashicons-admin-site"></i><?php _e('SubHeading position', 'wd-fb-og');?></th>
738
+ <td>
739
+ <select name="fb_subheading_position" id="fb_subheading_position">
740
+ <option value=""<?php if (trim($fb_subheading_position)=='after') echo ' selected="selected"'; ?>><?php _e('After', 'wd-fb-og');?></option>
741
+ <option value="before"<?php if (trim($fb_subheading_position)=='before') echo ' selected="selected"'; ?>><?php _e('Before', 'wd-fb-og');?></option>
742
+ </select>
743
  </td>
744
  </tr>
745
  </table>
938
  showDescriptionCustomText();
939
  showImageOptions();
940
  showFBNotifyOptions();
941
+ showSubheadingOptions();
942
  });
943
  function showAppidOptions() {
944
  if (jQuery('#fb_app_id_show').is(':checked')) {
1057
  jQuery('.fb_adv_notify_fb_options').hide();
1058
  }
1059
  }
1060
+ function showSubheadingOptions() {
1061
+ if (jQuery('#fb_show_subheading').is(':checked')) {
1062
+ jQuery('.fb_subheading_options').show();
1063
+ } else {
1064
+ jQuery('.fb_subheading_options').hide();
1065
+ }
1066
+ }
1067
  </script>
1068
  <style type="text/css">
1069
  .og_left_col {
lang/wd-fb-og-pt_PT.mo CHANGED
Binary file
lang/wd-fb-og-pt_PT.po CHANGED
@@ -3,8 +3,8 @@ msgstr ""
3
  "Project-Id-Version: Facebook Open Graph Meta Tags for WordPress v1.6.1\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wonderm00ns-simple-"
5
  "facebook-open-graph-tags\n"
6
- "POT-Creation-Date: 2015-12-15 14:52+0000\n"
7
- "PO-Revision-Date: 2015-12-15 14:56+0000\n"
8
  "Last-Translator: Wonderm00n <wonderm00n@gmail.com>\n"
9
  "Language-Team: Webdados <info@webdados.pt>\n"
10
  "Language: pt_PT\n"
@@ -12,7 +12,7 @@ msgstr ""
12
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
- "X-Generator: Poedit 1.8.6\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
18
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
@@ -554,6 +554,18 @@ msgstr ""
554
  msgid "Add SubHeading to Post/Page title"
555
  msgstr "Adicionar \"SubHeading\" ao título do artigo/página"
556
 
 
 
 
 
 
 
 
 
 
 
 
 
557
  # @ wd-fb-og
558
  #: includes/settings-page.php:746
559
  msgid "Use BDP listing contents as OG tags"
3
  "Project-Id-Version: Facebook Open Graph Meta Tags for WordPress v1.6.1\n"
4
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wonderm00ns-simple-"
5
  "facebook-open-graph-tags\n"
6
+ "POT-Creation-Date: 2016-04-01 18:52+0100\n"
7
+ "PO-Revision-Date: 2016-04-01 18:52+0100\n"
8
  "Last-Translator: Wonderm00n <wonderm00n@gmail.com>\n"
9
  "Language-Team: Webdados <info@webdados.pt>\n"
10
  "Language: pt_PT\n"
12
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
+ "X-Generator: Poedit 1.8.7\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
18
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
554
  msgid "Add SubHeading to Post/Page title"
555
  msgstr "Adicionar \"SubHeading\" ao título do artigo/página"
556
 
557
+ #: includes/settings-page.php:737
558
+ msgid "SubHeading position"
559
+ msgstr "Posição do \"SubHeading\""
560
+
561
+ #: includes/settings-page.php:740
562
+ msgid "After"
563
+ msgstr "Depois"
564
+
565
+ #: includes/settings-page.php:741
566
+ msgid "Before"
567
+ msgstr "Antes"
568
+
569
  # @ wd-fb-og
570
  #: includes/settings-page.php:746
571
  msgid "Use BDP listing contents as OG tags"
lang/wd-fb-og.pot CHANGED
@@ -395,6 +395,18 @@ msgstr ""
395
  msgid "Add SubHeading to Post/Page title"
396
  msgstr ""
397
 
 
 
 
 
 
 
 
 
 
 
 
 
398
  #: includes/settings-page.php:746
399
  msgid "Use BDP listing contents as OG tags"
400
  msgstr ""
395
  msgid "Add SubHeading to Post/Page title"
396
  msgstr ""
397
 
398
+ #: includes/settings-page.php:737
399
+ msgid "SubHeading position"
400
+ msgstr ""
401
+
402
+ #: includes/settings-page.php:740
403
+ msgid "After"
404
+ msgstr ""
405
+
406
+ #: includes/settings-page.php:741
407
+ msgid "Before"
408
+ msgstr ""
409
+
410
  #: includes/settings-page.php:746
411
  msgid "Use BDP listing contents as OG tags"
412
  msgstr ""
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, open graph protocol, share, social, meta, rss, twitter card, twitter, schema, google+, g+, google, google plus, image, like, seo, search engine optimization, woocommerce, yoast seo, subheading, php7
5
  Requires at least: 4.0
6
  Tested up to: 4.4.2
7
- Stable tag: 1.7.1
8
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and other Meta Tags into your WordPress Website for more efficient sharing results.
9
 
10
  == Description ==
@@ -99,7 +99,7 @@ If this is not a new post and it's not the first time you're saving it, and if t
99
  = Can this plugin get content from "random plugin"? =
100
 
101
  If there's a popular plugin you think we could get content from to use on the meta tags, use the support forum to tell us that.
102
- If you are a plugin or theme author you can always use our filters `fb_og_title`, `fb_og_desc`, `fb_og_url`, `fb_og_image`, `fb_og_image_additional` and `fb_og_locale` to customize the Open Graph (and other) meta tags output.
103
 
104
  = Do you provide email support? =
105
 
@@ -109,6 +109,11 @@ We DO NOT provide email support for this plugin. If you send us an email asking
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
112
  = 1.7.1 =
113
  - Added the fb_og_url filter so that plugins or themes can override the Open Graph URL
114
 
4
  Tags: facebook, open graph, open graph protocol, share, social, meta, rss, twitter card, twitter, schema, google+, g+, google, google plus, image, like, seo, search engine optimization, woocommerce, yoast seo, subheading, php7
5
  Requires at least: 4.0
6
  Tested up to: 4.4.2
7
+ Stable tag: 1.7.2
8
  Inserts Facebook Open Graph, Google+/Schema.org, Twitter and other Meta Tags into your WordPress Website for more efficient sharing results.
9
 
10
  == Description ==
99
  = Can this plugin get content from "random plugin"? =
100
 
101
  If there's a popular plugin you think we could get content from to use on the meta tags, use the support forum to tell us that.
102
+ If you are a plugin or theme author you can always use our filters `fb_og_title`, `fb_og_desc`, `fb_og_url`, `fb_og_type`, `fb_og_image`, `fb_og_image_additional` and `fb_og_locale` to customize the Open Graph (and other) meta tags output.
103
 
104
  = Do you provide email support? =
105
 
109
 
110
  == Changelog ==
111
 
112
+ = 1.7.2 =
113
+ - Better SubHeading plugin compatibility (choose either to add it Before or After the title)
114
+ - Description set the same value as the title if it's empty
115
+ - Added the fb_og_type filter so that plugins or themes can override the Open Graph Type
116
+
117
  = 1.7.1 =
118
  - Added the fb_og_url filter so that plugins or themes can override the Open Graph URL
119
 
wonderm00n-open-graph.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
- * @version 1.7.1
5
  */
6
  /*
7
  Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
8
  Plugin URI: http://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
9
  Description: Inserts Facebook Open Graph, Google+ / Schema.org and Twitter Card Tags into your WordPress Blog/Website for more effective and efficient Facebook, Google+ and Twitter 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
- Version: 1.7.1
11
  Author: Webdados
12
  Author URI: http://www.webdados.pt
13
  Text Domain: wd-fb-og
@@ -16,7 +16,7 @@ Domain Path: /lang
16
 
17
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18
 
19
- $webdados_fb_open_graph_plugin_version='1.7.1';
20
  $webdados_fb_open_graph_plugin_name='Facebook Open Graph, Google+ and Twitter Card Tags';
21
  $webdados_fb_open_graph_plugin_settings=array(
22
  'fb_app_id_show',
@@ -69,6 +69,7 @@ $webdados_fb_open_graph_plugin_settings=array(
69
  'fb_image_min_size',
70
  'fb_show_wpseoyoast',
71
  'fb_show_subheading',
 
72
  'fb_show_businessdirectoryplugin',
73
  'fb_keep_data_uninstall',
74
  'fb_adv_force_local',
@@ -76,7 +77,7 @@ $webdados_fb_open_graph_plugin_settings=array(
76
  'fb_adv_supress_fb_notice',
77
  'fb_twitter_card_type',
78
  'fb_wc_usecategthumb',
79
- 'fb_wc_useproductgallery'
80
  );
81
 
82
  //We have to remove canonical NOW because the plugin runs too late - We're also loading the settings which is cool
@@ -121,7 +122,11 @@ function webdados_fb_open_graph() {
121
  //SubHeading
122
  if ($fb_show_subheading==1) {
123
  if (webdados_fb_open_graph_subheadingactive()) {
124
- $fb_title.=' - '.get_the_subheading();
 
 
 
 
125
  }
126
  }
127
  $fb_url=get_permalink();
@@ -342,8 +347,15 @@ function webdados_fb_open_graph() {
342
  }
343
  }
344
  }
345
- //If no description let's just add the title
346
- if (trim($fb_desc)=='') $fb_desc=$fb_title;
 
 
 
 
 
 
 
347
 
348
  //YOAST?
349
  if ($fb_show_wpseoyoast==1) {
@@ -358,7 +370,11 @@ function webdados_fb_open_graph() {
358
  //Title - SubHeading plugin
359
  if ($fb_show_subheading==1) {
360
  if (webdados_fb_open_graph_subheadingactive()) {
361
- $fb_title.=' - '.get_the_subheading();
 
 
 
 
362
  }
363
  }
364
  //URL - From WPSEO
@@ -384,12 +400,15 @@ function webdados_fb_open_graph() {
384
  }
385
 
386
  //Apply Filters
 
387
  $fb_title = apply_filters('fb_og_title', $fb_title);
 
 
388
  $fb_desc = apply_filters('fb_og_desc', $fb_desc);
389
  $fb_image = apply_filters('fb_og_image', $fb_image);
390
- $fb_url = apply_filters('fb_og_url', $fb_url);
391
  $fb_image_additional = apply_filters('fb_og_image_additional', $fb_image_additional);
392
- $fb_locale = apply_filters('fb_og_locale', $fb_locale);
 
393
  $fb_image_size = false;
394
  if (intval($fb_image_show)==1 && trim($fb_image)!='') {
395
  if (intval($fb_image_size_show)==1) {
@@ -415,6 +434,9 @@ function webdados_fb_open_graph() {
415
  $fb_image_additional[$key] = str_replace(' ', '%20', trim($value));
416
  }
417
  }
 
 
 
418
 
419
  $html='
420
  <!-- START - '.$webdados_fb_open_graph_plugin_name.' '.$webdados_fb_open_graph_plugin_version.' -->
@@ -1100,7 +1122,8 @@ function webdados_fb_open_graph_default_values() {
1100
  'fb_keep_data_uninstall' => 1,
1101
  'fb_image_min_size' => 200,
1102
  'fb_adv_notify_fb' => 1,
1103
- 'fb_twitter_card_type' => 'summary_large_image'
 
1104
  );
1105
  }
1106
  function webdados_fb_open_graph_load_settings() {
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
+ * @version 1.7.2
5
  */
6
  /*
7
  Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
8
  Plugin URI: http://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
9
  Description: Inserts Facebook Open Graph, Google+ / Schema.org and Twitter Card Tags into your WordPress Blog/Website for more effective and efficient Facebook, Google+ and Twitter 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
+ Version: 1.7.2
11
  Author: Webdados
12
  Author URI: http://www.webdados.pt
13
  Text Domain: wd-fb-og
16
 
17
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18
 
19
+ $webdados_fb_open_graph_plugin_version='1.7.2';
20
  $webdados_fb_open_graph_plugin_name='Facebook Open Graph, Google+ and Twitter Card Tags';
21
  $webdados_fb_open_graph_plugin_settings=array(
22
  'fb_app_id_show',
69
  'fb_image_min_size',
70
  'fb_show_wpseoyoast',
71
  'fb_show_subheading',
72
+ 'fb_subheading_position',
73
  'fb_show_businessdirectoryplugin',
74
  'fb_keep_data_uninstall',
75
  'fb_adv_force_local',
77
  'fb_adv_supress_fb_notice',
78
  'fb_twitter_card_type',
79
  'fb_wc_usecategthumb',
80
+ 'fb_wc_useproductgallery',
81
  );
82
 
83
  //We have to remove canonical NOW because the plugin runs too late - We're also loading the settings which is cool
122
  //SubHeading
123
  if ($fb_show_subheading==1) {
124
  if (webdados_fb_open_graph_subheadingactive()) {
125
+ if (isset($fb_subheading_position) && $fb_subheading_position=='before') {
126
+ $fb_title=trim(trim(get_the_subheading()).' - '.trim($fb_title), ' -');
127
+ } else {
128
+ $fb_title=trim(trim($fb_title).' - '.trim(get_the_subheading()), ' -');
129
+ }
130
  }
131
  }
132
  $fb_url=get_permalink();
347
  }
348
  }
349
  }
350
+
351
+ //og:type for WPML root page?
352
+ if (function_exists('icl_object_id') && function_exists('icl_register_string')) {
353
+ if (class_exists('WPML_Root_Page')) {
354
+ if ( WPML_Root_Page::is_current_request_root() ) {
355
+ $fb_type=trim($fb_type_homepage=='' ? 'website' : $fb_type_homepage);
356
+ }
357
+ }
358
+ }
359
 
360
  //YOAST?
361
  if ($fb_show_wpseoyoast==1) {
370
  //Title - SubHeading plugin
371
  if ($fb_show_subheading==1) {
372
  if (webdados_fb_open_graph_subheadingactive()) {
373
+ if (isset($fb_subheading_position) && $fb_subheading_position=='before') {
374
+ $fb_title=trim(trim(get_the_subheading()).' - '.trim($fb_title), ' -');
375
+ } else {
376
+ $fb_title=trim(trim($fb_title).' - '.trim(get_the_subheading()), ' -');
377
+ }
378
  }
379
  }
380
  //URL - From WPSEO
400
  }
401
 
402
  //Apply Filters
403
+ $fb_locale = apply_filters('fb_og_locale', $fb_locale);
404
  $fb_title = apply_filters('fb_og_title', $fb_title);
405
+ $fb_url = apply_filters('fb_og_url', $fb_url);
406
+ $fb_type = apply_filters('fb_og_type', $fb_type);
407
  $fb_desc = apply_filters('fb_og_desc', $fb_desc);
408
  $fb_image = apply_filters('fb_og_image', $fb_image);
 
409
  $fb_image_additional = apply_filters('fb_og_image_additional', $fb_image_additional);
410
+
411
+ //Image size
412
  $fb_image_size = false;
413
  if (intval($fb_image_show)==1 && trim($fb_image)!='') {
414
  if (intval($fb_image_size_show)==1) {
434
  $fb_image_additional[$key] = str_replace(' ', '%20', trim($value));
435
  }
436
  }
437
+
438
+ //If no description let's just add the title as a last resort
439
+ if (trim($fb_desc)=='') $fb_desc=$fb_title;
440
 
441
  $html='
442
  <!-- START - '.$webdados_fb_open_graph_plugin_name.' '.$webdados_fb_open_graph_plugin_version.' -->
1122
  'fb_keep_data_uninstall' => 1,
1123
  'fb_image_min_size' => 200,
1124
  'fb_adv_notify_fb' => 1,
1125
+ 'fb_twitter_card_type' => 'summary_large_image',
1126
+ 'fb_subheading_position' => 'after',
1127
  );
1128
  }
1129
  function webdados_fb_open_graph_load_settings() {