Version Description
- Add
og:image:url
andog:image:secure_url
tags - Small tweaks on the image overlay functionality, including a new
fb_og_thumb_image
filter so you can have a diferent image overlay based on the post id - Tested with WordPress 5.1.1 and WooCommerce 3.6.0 (RC1)
Download this release
Release Info
Developer | webdados |
Plugin | Open Graph for Facebook, Google+ and Twitter Card Tags |
Version | 2.2.6 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.2.6
- fbimg.php +2 -4
- public/class-webdados-fb-open-graph-public.php +19 -4
- readme.txt +18 -2
- wonderm00n-open-graph.php +3 -3
fbimg.php
CHANGED
@@ -3,12 +3,10 @@
|
|
3 |
define('WP_USE_THEMES', false);
|
4 |
require( '../../../wp-blog-header.php' );
|
5 |
|
6 |
-
|
7 |
-
|
8 |
if ( $webdados_fb = webdados_fb_run() ) {
|
9 |
|
10 |
if ( isset($_GET['img']) && trim($_GET['img'])!='' ) {
|
11 |
-
if ( $url=parse_url(trim($_GET['img'])) ) {
|
12 |
if ( $url['host']==$_SERVER['HTTP_HOST'] ) {
|
13 |
|
14 |
if( $image=imagecreatefromfile($_SERVER['DOCUMENT_ROOT'].$url['path']) ) {
|
@@ -50,7 +48,7 @@
|
|
50 |
$width, $height);
|
51 |
//Barra
|
52 |
if ( trim($webdados_fb->options['fb_image_overlay_image'])!='' ) {
|
53 |
-
$barra_url = parse_url(trim($webdados_fb->options['fb_image_overlay_image']));
|
54 |
$barra = imagecreatefromfile($_SERVER['DOCUMENT_ROOT'].$barra_url['path']);
|
55 |
imagecopy($thumb, $barra, 0, 0, 0, 0, intval(WEBDADOS_FB_W), intval(WEBDADOS_FB_H) );
|
56 |
}
|
3 |
define('WP_USE_THEMES', false);
|
4 |
require( '../../../wp-blog-header.php' );
|
5 |
|
|
|
|
|
6 |
if ( $webdados_fb = webdados_fb_run() ) {
|
7 |
|
8 |
if ( isset($_GET['img']) && trim($_GET['img'])!='' ) {
|
9 |
+
if ( $url=parse_url(urldecode(trim($_GET['img']))) ) {
|
10 |
if ( $url['host']==$_SERVER['HTTP_HOST'] ) {
|
11 |
|
12 |
if( $image=imagecreatefromfile($_SERVER['DOCUMENT_ROOT'].$url['path']) ) {
|
48 |
$width, $height);
|
49 |
//Barra
|
50 |
if ( trim($webdados_fb->options['fb_image_overlay_image'])!='' ) {
|
51 |
+
$barra_url = parse_url( apply_filters( 'fb_og_thumb_image', trim($webdados_fb->options['fb_image_overlay_image']), intval($_GET['post_id']) ) );
|
52 |
$barra = imagecreatefromfile($_SERVER['DOCUMENT_ROOT'].$barra_url['path']);
|
53 |
imagecopy($thumb, $barra, 0, 0, 0, 0, intval(WEBDADOS_FB_W), intval(WEBDADOS_FB_H) );
|
54 |
}
|
public/class-webdados-fb-open-graph-public.php
CHANGED
@@ -538,9 +538,10 @@ class Webdados_FB_Public {
|
|
538 |
|
539 |
//Image overlay - Single?
|
540 |
if ( intval($this->options['fb_image_show'])==1 && intval($this->options['fb_image_overlay'])==1 && apply_filters('fb_og_image_overlay', true, $fb_image) ) {
|
|
|
541 |
$debug[] = 'image overlay';
|
542 |
//Single
|
543 |
-
$temp_fb_image_overlay = $this->get_image_with_overlay($fb_image);
|
544 |
if ( $temp_fb_image_overlay['overlay'] ) {
|
545 |
$fb_image = $temp_fb_image_overlay['fb_image'];
|
546 |
//We know the exact size now. We better just show it, right?
|
@@ -551,7 +552,7 @@ class Webdados_FB_Public {
|
|
551 |
if ( isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)>0 ) {
|
552 |
foreach($fb_image_additional as $key => $value ) {
|
553 |
if ( isset($value['png_overlay']) && $value['png_overlay'] ) {
|
554 |
-
$temp_fb_image_overlay = $this->get_image_with_overlay($value['fb_image']);
|
555 |
if ( $temp_fb_image_overlay['overlay'] ) {
|
556 |
$fb_image_additional[$key]['fb_image'] = $temp_fb_image_overlay['fb_image'];
|
557 |
}
|
@@ -600,13 +601,23 @@ class Webdados_FB_Public {
|
|
600 |
';
|
601 |
//Image
|
602 |
if( intval($this->options['fb_image_show'])==1 && trim($fb_image)!='' ) $html.=' <meta property="og:image" content="'.esc_attr(trim($fb_image)).'"/>
|
|
|
603 |
';
|
|
|
|
|
|
|
|
|
604 |
//Additional Images
|
605 |
if( intval($this->options['fb_image_show'])==1 && isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)>0 ) {
|
606 |
foreach ($fb_image_additional as $fb_image_additional_temp) {
|
607 |
if ( isset($fb_image_additional_temp['fb_image']) && trim($fb_image_additional_temp['fb_image'])!='' ) {
|
608 |
$html.=' <meta property="og:image" content="'.esc_attr(trim($fb_image_additional_temp['fb_image'])).'"/>
|
|
|
|
|
|
|
|
|
609 |
';
|
|
|
610 |
}
|
611 |
}
|
612 |
} else {
|
@@ -930,11 +941,15 @@ class Webdados_FB_Public {
|
|
930 |
|
931 |
|
932 |
/* Image with overlay URL */
|
933 |
-
private function get_image_with_overlay($fb_image) {
|
934 |
$fb_image_parsed = parse_url($fb_image);
|
935 |
//Only if the image is hosted locally
|
936 |
if ( $fb_image_parsed['host']==$_SERVER['HTTP_HOST'] ) {
|
937 |
-
$
|
|
|
|
|
|
|
|
|
938 |
return array(
|
939 |
'overlay' => true,
|
940 |
'fb_image' => $fb_image,
|
538 |
|
539 |
//Image overlay - Single?
|
540 |
if ( intval($this->options['fb_image_show'])==1 && intval($this->options['fb_image_overlay'])==1 && apply_filters('fb_og_image_overlay', true, $fb_image) ) {
|
541 |
+
$post_id = $this->post ? $this->post->ID : 0;
|
542 |
$debug[] = 'image overlay';
|
543 |
//Single
|
544 |
+
$temp_fb_image_overlay = $this->get_image_with_overlay( $fb_image, $post_id );
|
545 |
if ( $temp_fb_image_overlay['overlay'] ) {
|
546 |
$fb_image = $temp_fb_image_overlay['fb_image'];
|
547 |
//We know the exact size now. We better just show it, right?
|
552 |
if ( isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)>0 ) {
|
553 |
foreach($fb_image_additional as $key => $value ) {
|
554 |
if ( isset($value['png_overlay']) && $value['png_overlay'] ) {
|
555 |
+
$temp_fb_image_overlay = $this->get_image_with_overlay( $value['fb_image'], $post_id );
|
556 |
if ( $temp_fb_image_overlay['overlay'] ) {
|
557 |
$fb_image_additional[$key]['fb_image'] = $temp_fb_image_overlay['fb_image'];
|
558 |
}
|
601 |
';
|
602 |
//Image
|
603 |
if( intval($this->options['fb_image_show'])==1 && trim($fb_image)!='' ) $html.=' <meta property="og:image" content="'.esc_attr(trim($fb_image)).'"/>
|
604 |
+
<meta property="og:image:url" content="'.esc_attr(trim($fb_image)).'"/>
|
605 |
';
|
606 |
+
if ( strpos( trim($fb_image), 'https://' ) === 0 ) {
|
607 |
+
$html.=' <meta property="og:image:secure_url" content="'.esc_attr(trim($fb_image)).'"/>
|
608 |
+
';
|
609 |
+
}
|
610 |
//Additional Images
|
611 |
if( intval($this->options['fb_image_show'])==1 && isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)>0 ) {
|
612 |
foreach ($fb_image_additional as $fb_image_additional_temp) {
|
613 |
if ( isset($fb_image_additional_temp['fb_image']) && trim($fb_image_additional_temp['fb_image'])!='' ) {
|
614 |
$html.=' <meta property="og:image" content="'.esc_attr(trim($fb_image_additional_temp['fb_image'])).'"/>
|
615 |
+
<meta property="og:image:url" content="'.esc_attr(trim($fb_image_additional_temp['fb_image'])).'"/>
|
616 |
+
';
|
617 |
+
if ( strpos( trim($fb_image_additional_temp['fb_image']), 'https://' ) === 0 ) {
|
618 |
+
$html.=' <meta property="og:image:secure_url" content="'.esc_attr(trim($fb_image_additional_temp['fb_image'])).'"/>
|
619 |
';
|
620 |
+
}
|
621 |
}
|
622 |
}
|
623 |
} else {
|
941 |
|
942 |
|
943 |
/* Image with overlay URL */
|
944 |
+
private function get_image_with_overlay( $fb_image, $post_id = 0 ) {
|
945 |
$fb_image_parsed = parse_url($fb_image);
|
946 |
//Only if the image is hosted locally
|
947 |
if ( $fb_image_parsed['host']==$_SERVER['HTTP_HOST'] ) {
|
948 |
+
$params = array(
|
949 |
+
'img' => urlencode($fb_image),
|
950 |
+
'post_id' => intval( $post_id ),
|
951 |
+
);
|
952 |
+
$fb_image = plugins_url( '/wonderm00ns-simple-facebook-open-graph-tags/fbimg.php' ).'?'.http_build_query($params);
|
953 |
return array(
|
954 |
'overlay' => true,
|
955 |
'fb_image' => $fb_image,
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: webdados, wonderm00n
|
|
3 |
Donate link: http://bit.ly/donate_fb_opengraph
|
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, wordpress seo, woocommerce, subheading, php7, webdados
|
5 |
Requires at least: 4.5
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 2.2.
|
8 |
|
9 |
Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
|
10 |
|
@@ -31,6 +31,8 @@ Our settings page is discreetly kept under "Options", as it should, instead of t
|
|
31 |
* **og:url**: From the post/page permalink.
|
32 |
* **og:description**: From our specific custom field of the post/page, or if not set post/page excerpt if it exist, or from post/page content. From category/tag description on it's pages, if it exist. From tagline, or custom text, on all the others.
|
33 |
* **og:image**: From our specific custom field of the post/page, or if not set from the post/page featured/thumbnail image, or if it doesn't exist from the first image in the post content, or if it doesn't exist from the first image on the post media gallery, or if it doesn't exist from the default image defined on the options menu. The same image chosen here will be used and enclosure/media:content on the RSS feed.
|
|
|
|
|
34 |
* **og:image:width** and **og:image:height**: Image dimensions.
|
35 |
* **og:type**: "website" or "blog" for the homepage, "product" for WooCommerce products and "article" for all the others.
|
36 |
* **article:author**: From the user (post author) Faceboook Profile URL.
|
@@ -90,6 +92,15 @@ Our settings page is discreetly kept under "Options", as it should, instead of t
|
|
90 |
|
91 |
== Frequently Asked Questions ==
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
= Facebook is not showing up the correct image when I share a post. What can I do? =
|
94 |
|
95 |
1. Are you using a big enough image? The minimum image size is 200x200 pixels but we recommend 1200x630.
|
@@ -157,6 +168,11 @@ We DO NOT provide email support for this plugin. If you send us an email asking
|
|
157 |
|
158 |
== Changelog ==
|
159 |
|
|
|
|
|
|
|
|
|
|
|
160 |
= 2.2.5 =
|
161 |
* No `og:description` for password protected and private posts (Thanks for the heads up Benoît)
|
162 |
* Tested with WordPress 5.0.3 and WooCommerce 3.5.3
|
3 |
Donate link: http://bit.ly/donate_fb_opengraph
|
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, wordpress seo, woocommerce, subheading, php7, webdados
|
5 |
Requires at least: 4.5
|
6 |
+
Tested up to: 5.1.1
|
7 |
+
Stable tag: 2.2.6
|
8 |
|
9 |
Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
|
10 |
|
31 |
* **og:url**: From the post/page permalink.
|
32 |
* **og:description**: From our specific custom field of the post/page, or if not set post/page excerpt if it exist, or from post/page content. From category/tag description on it's pages, if it exist. From tagline, or custom text, on all the others.
|
33 |
* **og:image**: From our specific custom field of the post/page, or if not set from the post/page featured/thumbnail image, or if it doesn't exist from the first image in the post content, or if it doesn't exist from the first image on the post media gallery, or if it doesn't exist from the default image defined on the options menu. The same image chosen here will be used and enclosure/media:content on the RSS feed.
|
34 |
+
* **og:image:url**: Same as **og:image**.
|
35 |
+
* **og:image:secure_url**: Same as **og:image** if SSL is being used.
|
36 |
* **og:image:width** and **og:image:height**: Image dimensions.
|
37 |
* **og:type**: "website" or "blog" for the homepage, "product" for WooCommerce products and "article" for all the others.
|
38 |
* **article:author**: From the user (post author) Faceboook Profile URL.
|
92 |
|
93 |
== Frequently Asked Questions ==
|
94 |
|
95 |
+
= Why aren't you active on the support forums? =
|
96 |
+
|
97 |
+
Because of other commercial projects, including WordPress and WooCommerce plugins, we haven’t been able to reply to support tickets neither release new versions of this plugin, for which we are sorry.
|
98 |
+
|
99 |
+
We will fix any security issue that might arise but, at this moment, we cannot promise we’ll get back to active development and support on this plugin anytime soon.
|
100 |
+
|
101 |
+
If some company wants to make a proposal to take ownership of this plugin, please contact us to info @ webdados .pt
|
102 |
+
We’ll not pass ownership of the plugin to anyone (person or company) that does not have a solid roadmap and business model for this plugin, in order to guarantee the current users that development and support will be resumed.
|
103 |
+
|
104 |
= Facebook is not showing up the correct image when I share a post. What can I do? =
|
105 |
|
106 |
1. Are you using a big enough image? The minimum image size is 200x200 pixels but we recommend 1200x630.
|
168 |
|
169 |
== Changelog ==
|
170 |
|
171 |
+
= 2.2.6 =
|
172 |
+
* Add `og:image:url` and `og:image:secure_url` tags
|
173 |
+
* Small tweaks on the image overlay functionality, including a new `fb_og_thumb_image` filter so you can have a diferent image overlay based on the post id
|
174 |
+
* Tested with WordPress 5.1.1 and WooCommerce 3.6.0 (RC1)
|
175 |
+
|
176 |
= 2.2.5 =
|
177 |
* No `og:description` for password protected and private posts (Thanks for the heads up Benoît)
|
178 |
* Tested with WordPress 5.0.3 and WooCommerce 3.5.3
|
wonderm00n-open-graph.php
CHANGED
@@ -3,17 +3,17 @@
|
|
3 |
Plugin Name: Open Graph for Facebook, Google+ and Twitter Card Tags
|
4 |
Plugin URI: https://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
|
5 |
Description: Inserts Facebook Open Graph, Google+/Schema.org, Twitter Card and SEO Meta 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.
|
6 |
-
Version: 2.2.
|
7 |
Author: Webdados
|
8 |
Author URI: https://www.webdados.pt
|
9 |
Text Domain: wonderm00ns-simple-facebook-open-graph-tags
|
10 |
Domain Path: /lang
|
11 |
-
WC tested up to: 3.
|
12 |
*/
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
15 |
|
16 |
-
define( 'WEBDADOS_FB_VERSION', '2.2.
|
17 |
define( 'WEBDADOS_FB_PLUGIN_NAME', 'Open Graph for Facebook, Google+ and Twitter Card Tags' );
|
18 |
define( 'WEBDADOS_FB_W', 1200 );
|
19 |
define( 'WEBDADOS_FB_H', 630 );
|
3 |
Plugin Name: Open Graph for Facebook, Google+ and Twitter Card Tags
|
4 |
Plugin URI: https://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
|
5 |
Description: Inserts Facebook Open Graph, Google+/Schema.org, Twitter Card and SEO Meta 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.
|
6 |
+
Version: 2.2.6
|
7 |
Author: Webdados
|
8 |
Author URI: https://www.webdados.pt
|
9 |
Text Domain: wonderm00ns-simple-facebook-open-graph-tags
|
10 |
Domain Path: /lang
|
11 |
+
WC tested up to: 3.6.0
|
12 |
*/
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
15 |
|
16 |
+
define( 'WEBDADOS_FB_VERSION', '2.2.6' );
|
17 |
define( 'WEBDADOS_FB_PLUGIN_NAME', 'Open Graph for Facebook, Google+ and Twitter Card Tags' );
|
18 |
define( 'WEBDADOS_FB_W', 1200 );
|
19 |
define( 'WEBDADOS_FB_H', 630 );
|