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

Version Description

  • WooCommerce integration: on product pages sets og:type to product and adds the price including tax to the product:price tags
Download this release

Release Info

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

Code changes from version 1.7.4 to 1.7.4.1

includes/settings-page.php CHANGED
@@ -717,6 +717,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
717
  <hr/>
718
  <a name="woocommerce"></a>
719
  <h4><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a></h4>
 
720
  <table width="100%" class="form-table">
721
  <tr>
722
  <th scope="row"><i class="dashicons-before dashicons-cart"></i><?php _e('Use Product Category thumbnail as Open Graph Image', 'wd-fb-og');?></th>
717
  <hr/>
718
  <a name="woocommerce"></a>
719
  <h4><a href="https://wordpress.org/plugins/woocommerce/" target="_blank">WooCommerce</a></h4>
720
+ <p><?php _e('On product pages we will automatically set og:type to "product" and add the price including tax to the product:price tags.', 'wd-fb-og');?></p>
721
  <table width="100%" class="form-table">
722
  <tr>
723
  <th scope="row"><i class="dashicons-before dashicons-cart"></i><?php _e('Use Product Category thumbnail as Open Graph Image', 'wd-fb-og');?></th>
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.5
7
- Stable tag: 1.7.4
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 ==
@@ -111,6 +111,9 @@ We DO NOT provide email support for this plugin. If you send us an email asking
111
 
112
  == Changelog ==
113
 
 
 
 
114
  = 1.7.4 =
115
  - New beta feature: Add overlay PNG logo to the image
116
  - Minor fixes
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.5
7
+ Stable tag: 1.7.4.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 ==
111
 
112
  == Changelog ==
113
 
114
+ = 1.7.4.1 =
115
+ - WooCommerce integration: on product pages sets `og:type` to `product` and adds the price including tax to the `product:price` tags
116
+
117
  = 1.7.4 =
118
  - New beta feature: Add overlay PNG logo to the image
119
  - Minor fixes
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.4
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.4
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.4';
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',
@@ -116,6 +116,9 @@ function webdados_fb_open_graph() {
116
  //Additional images
117
  $fb_image_additional=array();
118
 
 
 
 
119
  $fb_type='article';
120
  if (is_singular()) {
121
  //It's a Post or a Page or an attachment page - It can also be the homepage if it's set as a page
@@ -400,6 +403,23 @@ function webdados_fb_open_graph() {
400
  }
401
  }
402
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
403
 
404
  //Apply Filters
405
  $fb_locale = apply_filters('fb_og_locale', $fb_locale);
@@ -525,6 +545,12 @@ if (intval($fb_article_sections_show)==1 && isset($fb_sections) && is_array($fb_
525
  ';
526
  if(intval($fb_title_show_twitter)==1 || intval($fb_url_show_twitter)==1 || $fb_author_show_twitter==1 || $fb_publisher_show_twitter==1 || $fb_image_show_twitter==1) $html.='<meta name="twitter:card" content="'.trim(esc_attr($fb_twitter_card_type)).'"/>
527
  ';
 
 
 
 
 
 
528
  $html.='<!-- END - '.$webdados_fb_open_graph_plugin_name.' -->
529
 
530
  ';
1
  <?php
2
  /**
3
  * @package Facebook Open Graph, Google+ and Twitter Card Tags
4
+ * @version 1.7.4.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.4.1
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.4.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',
116
  //Additional images
117
  $fb_image_additional=array();
118
 
119
+ //Additional tags
120
+ $fb_additional_tags=array();
121
+
122
  $fb_type='article';
123
  if (is_singular()) {
124
  //It's a Post or a Page or an attachment page - It can also be the homepage if it's set as a page
403
  }
404
  }
405
  }
406
+ //WooCommerce - og:type, price, etc...
407
+ if ( class_exists('woocommerce') && is_product() ) {
408
+ $fb_type = 'product';
409
+ global $product;
410
+ $fb_additional_tags['og_price_amount']=array(
411
+ $product->get_price_including_tax()
412
+ );
413
+ if (function_exists('get_woocommerce_currency')) $fb_additional_tags['og_price_currency']=array(
414
+ get_woocommerce_currency()
415
+ );
416
+ $fb_additional_tags['twitter_label1']=array(
417
+ __('Price', 'wd-fb-og')
418
+ );
419
+ if (function_exists('get_woocommerce_currency')) $fb_additional_tags['twitter_data1']=array(
420
+ $product->get_price_including_tax().' '.get_woocommerce_currency()
421
+ );
422
+ }
423
 
424
  //Apply Filters
425
  $fb_locale = apply_filters('fb_og_locale', $fb_locale);
545
  ';
546
  if(intval($fb_title_show_twitter)==1 || intval($fb_url_show_twitter)==1 || $fb_author_show_twitter==1 || $fb_publisher_show_twitter==1 || $fb_image_show_twitter==1) $html.='<meta name="twitter:card" content="'.trim(esc_attr($fb_twitter_card_type)).'"/>
547
  ';
548
+ foreach ($fb_additional_tags as $tag => $values) {
549
+ foreach($values as $value) {
550
+ $html.='<meta name="'.str_replace('_', ':', trim($tag)).'" content="'.trim(esc_attr($value)).'"/>
551
+ ';
552
+ }
553
+ }
554
  $html.='<!-- END - '.$webdados_fb_open_graph_plugin_name.' -->
555
 
556
  ';