Version Description
- Added the Schema.org headline, author, datePublished and dateModified tags
- Removed some unnecessary / duplicated
esc_attr
calls
Download this release
Release Info
Developer | webdados |
Plugin | Open Graph for Facebook, Google+ and Twitter Card Tags |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2 to 2.2.1
admin/options-page-schema.php
CHANGED
@@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
23 |
</tr>
|
24 |
<tr>
|
25 |
<td colspan="2" class="info">
|
26 |
-
<i><meta itemprop="name" content="..."/></i>
|
27 |
<br/>
|
28 |
- <?php printf( __( 'You can change this value using the <i>%1$s</i> filter', 'wonderm00ns-simple-facebook-open-graph-tags' ), 'fb_og_title' ); ?>
|
29 |
</td>
|
@@ -124,13 +124,28 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
124 |
<tr>
|
125 |
<th><?php _e( 'Include Post/Page Author', 'wonderm00ns-simple-facebook-open-graph-tags' );?>:</th>
|
126 |
<td>
|
127 |
-
<
|
128 |
-
<input type="hidden" name="wonderm00n_open_graph_settings[fb_author_show_linkrelgp]" id="fb_author_show_linkrelgp" value="0"/>
|
129 |
</td>
|
130 |
</tr>
|
131 |
<tr>
|
132 |
<td colspan="2" class="info">
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
</td>
|
135 |
</tr>
|
136 |
|
23 |
</tr>
|
24 |
<tr>
|
25 |
<td colspan="2" class="info">
|
26 |
+
<i><meta itemprop="name" content="..."/></i> <?php _e('and', 'wonderm00ns-simple-facebook-open-graph-tags'); ?> <i><meta itemprop="headline" content="..."/></i>
|
27 |
<br/>
|
28 |
- <?php printf( __( 'You can change this value using the <i>%1$s</i> filter', 'wonderm00ns-simple-facebook-open-graph-tags' ), 'fb_og_title' ); ?>
|
29 |
</td>
|
124 |
<tr>
|
125 |
<th><?php _e( 'Include Post/Page Author', 'wonderm00ns-simple-facebook-open-graph-tags' );?>:</th>
|
126 |
<td>
|
127 |
+
<input type="checkbox" name="wonderm00n_open_graph_settings[fb_author_show_schema]" id="fb_author_show_schema" value="1" <?php echo (intval($options['fb_author_show_schema'])==1 ? ' checked="checked"' : ''); ?>/>
|
|
|
128 |
</td>
|
129 |
</tr>
|
130 |
<tr>
|
131 |
<td colspan="2" class="info">
|
132 |
+
<i><meta itemprop="author" content="..."/></i>
|
133 |
+
<br/>
|
134 |
+
- <?php _e('From the user Display name', 'wonderm00ns-simple-facebook-open-graph-tags');?>
|
135 |
+
</td>
|
136 |
+
</tr>
|
137 |
+
|
138 |
+
<tr>
|
139 |
+
<th><?php _e( 'Include Published/Modified Dates', 'wonderm00ns-simple-facebook-open-graph-tags' );?>:</th>
|
140 |
+
<td>
|
141 |
+
<input type="checkbox" name="wonderm00n_open_graph_settings[fb_article_dates_show_schema]" id="fb_article_dates_show_schema" value="1" <?php echo (intval($options['fb_article_dates_show_schema'])==1 ? ' checked="checked"' : ''); ?>/>
|
142 |
+
</td>
|
143 |
+
</tr>
|
144 |
+
<tr>
|
145 |
+
<td colspan="2" class="info">
|
146 |
+
<i><itemprop="datePublished" content="..."/></i> <?php _e('and', 'wonderm00ns-simple-facebook-open-graph-tags'); ?> <i><meta itemprop="dateModified" content="..."/></i>
|
147 |
+
<br/>
|
148 |
+
- <?php _e( 'For posts only', 'wonderm00ns-simple-facebook-open-graph-tags' );?>
|
149 |
</td>
|
150 |
</tr>
|
151 |
|
includes/class-webdados-fb-open-graph.php
CHANGED
@@ -72,6 +72,8 @@ class Webdados_FB {
|
|
72 |
'fb_title_show_schema' => 1,
|
73 |
'fb_desc_show_schema' => 1,
|
74 |
'fb_image_show_schema' => 1,
|
|
|
|
|
75 |
'fb_publisher_show_schema' => 1,
|
76 |
//SEO
|
77 |
//...
|
@@ -106,6 +108,7 @@ class Webdados_FB {
|
|
106 |
'fb_type_schema_homepage' => 'trim',
|
107 |
'fb_type_schema_post' => 'trim',
|
108 |
'fb_article_dates_show' => 'intval',
|
|
|
109 |
'fb_article_sections_show' => 'intval',
|
110 |
'fb_publisher_show' => 'intval',
|
111 |
'fb_publisher' => 'trim',
|
@@ -114,6 +117,7 @@ class Webdados_FB {
|
|
114 |
'fb_publisher_show_twitter' => 'intval',
|
115 |
'fb_publisher_twitteruser' => 'trim',
|
116 |
'fb_author_show' => 'intval',
|
|
|
117 |
'fb_author_show_meta' => 'intval',
|
118 |
'fb_author_show_linkrelgp' => 'intval',
|
119 |
'fb_author_show_twitter' => 'intval',
|
72 |
'fb_title_show_schema' => 1,
|
73 |
'fb_desc_show_schema' => 1,
|
74 |
'fb_image_show_schema' => 1,
|
75 |
+
'fb_author_show_schema' => 1,
|
76 |
+
'fb_article_dates_show_schema' => 1,
|
77 |
'fb_publisher_show_schema' => 1,
|
78 |
//SEO
|
79 |
//...
|
108 |
'fb_type_schema_homepage' => 'trim',
|
109 |
'fb_type_schema_post' => 'trim',
|
110 |
'fb_article_dates_show' => 'intval',
|
111 |
+
'fb_article_dates_show_schema' => 'intval',
|
112 |
'fb_article_sections_show' => 'intval',
|
113 |
'fb_publisher_show' => 'intval',
|
114 |
'fb_publisher' => 'trim',
|
117 |
'fb_publisher_show_twitter' => 'intval',
|
118 |
'fb_publisher_twitteruser' => 'trim',
|
119 |
'fb_author_show' => 'intval',
|
120 |
+
'fb_author_show_schema' => 'intval',
|
121 |
'fb_author_show_meta' => 'intval',
|
122 |
'fb_author_show_linkrelgp' => 'intval',
|
123 |
'fb_author_show_twitter' => 'intval',
|
public/class-webdados-fb-open-graph-public.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Facebook Open Graph, Google+ and Twitter Card Tags
|
4 |
-
* @version 2.2
|
5 |
*/
|
6 |
|
7 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
@@ -113,7 +113,7 @@ class Webdados_FB_Public {
|
|
113 |
global $post;
|
114 |
// Title
|
115 |
//It's a Post or a Page or an attachment page - It can also be the homepage if it's set as a page
|
116 |
-
$fb_title =
|
117 |
//SubHeading
|
118 |
if ( isset($this->options['fb_show_subheading']) && intval($this->options['fb_show_subheading'])==1 && $webdados_fb->is_subheading_plugin_active() ) {
|
119 |
if (isset($this->options['fb_subheading_position']) && $this->options['fb_subheading_position']=='before' ) {
|
@@ -183,7 +183,7 @@ class Webdados_FB_Public {
|
|
183 |
$current_view_object = $wpbdp->dispatcher->current_view_object();
|
184 |
switch( $bdp_action ) {
|
185 |
case 'show_listing':
|
186 |
-
$fb_title = trim(
|
187 |
$fb_set_title_tag = 1;
|
188 |
$fb_url = get_permalink($this->post->ID);
|
189 |
if ( trim($this->post->post_excerpt)!='' ) {
|
@@ -263,7 +263,7 @@ class Webdados_FB_Public {
|
|
263 |
} else {
|
264 |
|
265 |
//Other pages - Defaults
|
266 |
-
$fb_title =
|
267 |
$fb_url = ( ( !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://' ).$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //Not really canonical but will work for now
|
268 |
$fb_image = trim( $this->options['fb_image'] );
|
269 |
|
@@ -277,24 +277,24 @@ class Webdados_FB_Public {
|
|
277 |
|
278 |
//Category
|
279 |
if ( is_category() ) {
|
280 |
-
$fb_title =
|
281 |
$term = $wp_query->get_queried_object();
|
282 |
$fb_url = get_term_link( $term, $term->taxonomy );
|
283 |
-
$cat_desc = trim(
|
284 |
if ( trim($cat_desc)!='' ) $fb_desc = $cat_desc;
|
285 |
} else {
|
286 |
if ( is_tag() ) {
|
287 |
-
$fb_title =
|
288 |
$term = $wp_query->get_queried_object();
|
289 |
$fb_url = get_term_link( $term, $term->taxonomy );
|
290 |
-
$tag_desc = trim(
|
291 |
if ( trim($tag_desc)!='' ) $fb_desc = $tag_desc;
|
292 |
} else {
|
293 |
if (is_tax()) {
|
294 |
-
$fb_title =
|
295 |
$term = $wp_query->get_queried_object();
|
296 |
$fb_url = get_term_link($term, $term->taxonomy);
|
297 |
-
$tax_desc = trim(
|
298 |
if ( trim($tax_desc)!='' ) $fb_desc = $tax_desc;
|
299 |
//WooCommerce
|
300 |
if ( $webdados_fb->is_woocommerce_active() && intval($this->options['fb_wc_usecategthumb'])==1 && is_product_category() ) {
|
@@ -308,24 +308,24 @@ class Webdados_FB_Public {
|
|
308 |
}
|
309 |
} else {
|
310 |
if ( is_search() ) {
|
311 |
-
$fb_title =
|
312 |
$fb_url = get_search_link();
|
313 |
} else {
|
314 |
if (is_author()) {
|
315 |
-
$fb_title =
|
316 |
$fb_url = get_author_posts_url( get_query_var('author'), get_query_var('author_name') );
|
317 |
} else {
|
318 |
if ( is_archive() ) {
|
319 |
if ( is_day() ) {
|
320 |
-
$fb_title =
|
321 |
$fb_url = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
|
322 |
} else {
|
323 |
if ( is_month() ) {
|
324 |
-
$fb_title =
|
325 |
$fb_url = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
|
326 |
} else {
|
327 |
if ( is_year() ) {
|
328 |
-
$fb_title =
|
329 |
$fb_url = get_year_link( get_query_var( 'year' ) );
|
330 |
}
|
331 |
}
|
@@ -549,106 +549,118 @@ class Webdados_FB_Public {
|
|
549 |
$html.=' <!-- Facebook Open Graph -->
|
550 |
';
|
551 |
//Locale
|
552 |
-
if ( intval($this->options['fb_locale_show'])==1 ) $html.=' <meta property="og:locale" content="'.trim(
|
553 |
';
|
554 |
//Site name
|
555 |
-
if ( intval($this->options['fb_sitename_show'])==1 ) $html.=' <meta property="og:site_name" content="'.trim(
|
556 |
';
|
557 |
//Title
|
558 |
-
if ( intval($this->options['fb_title_show'])==1 && trim($fb_title)!='' ) $html.=' <meta property="og:title" content="'.trim(
|
559 |
';
|
560 |
//URL
|
561 |
-
if ( intval($this->options['fb_url_show'])==1 && trim($fb_url)!='' ) $html.=' <meta property="og:url" content="'.trim(
|
562 |
';
|
563 |
//Type
|
564 |
-
if ( intval($this->options['fb_type_show'])==1 && trim($fb_type)!='' ) $html.=' <meta property="og:type" content="'.trim(
|
565 |
';
|
566 |
//Description
|
567 |
-
if ( intval($this->options['fb_desc_show'])==1 && trim($fb_desc)!='' ) $html.=' <meta property="og:description" content="'.trim(
|
568 |
';
|
569 |
//Image
|
570 |
-
if( intval($this->options['fb_image_show'])==1 && trim($fb_image)!='' ) $html.=' <meta property="og:image" content="'.trim(
|
571 |
';
|
572 |
//Additional Images
|
573 |
if( intval($this->options['fb_image_show'])==1 && isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)>0 ) {
|
574 |
foreach ($fb_image_additional as $fb_image_additional_temp) {
|
575 |
if ( isset($fb_image_additional_temp['fb_image']) && trim($fb_image_additional_temp['fb_image'])!='' ) {
|
576 |
-
$html.=' <meta property="og:image" content="'.trim(
|
577 |
';
|
578 |
}
|
579 |
}
|
580 |
} else {
|
581 |
//Image Size - We only show the image size if we only have one image
|
582 |
-
if( intval($this->options['fb_image_size_show'])==1 && isset($fb_image_size) && is_array($fb_image_size) ) $html.=' <meta property="og:image:width" content="'.intval(
|
583 |
-
<meta property="og:image:height" content="'.intval(
|
584 |
';
|
585 |
}
|
586 |
//Dates
|
587 |
-
if ( intval($this->options['fb_article_dates_show'])==1 && trim($fb_article_pub_date)!='' ) $html.=' <meta property="article:published_time" content="'.trim(
|
588 |
';
|
589 |
-
if ( intval($this->options['fb_article_dates_show'])==1 && trim($fb_article_mod_date)!='') $html.=' <meta property="article:modified_time" content="'.trim(
|
590 |
-
<meta property="og:updated_time" content="'.trim(
|
591 |
';
|
592 |
//Sections
|
593 |
if (intval($this->options['fb_article_sections_show'])==1 && isset($fb_sections) && is_array($fb_sections) && count($fb_sections)>0) {
|
594 |
foreach($fb_sections as $fb_section) {
|
595 |
-
$html.=' <meta property="article:section" content="'.trim(
|
596 |
';
|
597 |
}
|
598 |
}
|
599 |
//Author
|
600 |
-
if ( intval($this->options['fb_author_show'])==1 && $fb_author!='') $html.=' <meta property="article:author" content="'.trim(
|
601 |
';
|
602 |
//Publisher
|
603 |
-
if ( intval($this->options['fb_publisher_show'])==1 && trim($fb_publisher)!='') $html.=' <meta property="article:publisher" content="'.trim(
|
604 |
';
|
605 |
//App ID
|
606 |
-
if ( intval($this->options['fb_app_id_show'])==1 && trim($fb_app_id)!='' ) $html.=' <meta property="fb:app_id" content="'.trim(
|
607 |
';
|
608 |
//Admins
|
609 |
-
if ( intval($this->options['fb_admin_id_show'])==1 && trim($this->options['fb_admin_id'])!='' ) $html.=' <meta property="fb:admins" content="'.trim(
|
610 |
';
|
611 |
// Schema
|
612 |
$html.=' <!-- Google+ / Schema.org -->
|
613 |
';
|
614 |
//Title
|
615 |
-
if ( intval($this->options['fb_title_show_schema'])==1 && trim($fb_title)!='' ) $html.=' <meta itemprop="name" content="'.trim(
|
|
|
616 |
';
|
617 |
//Description
|
618 |
-
if ( intval($this->options['fb_desc_show_schema'])==1 && trim($fb_desc)!='' ) $html.=' <meta itemprop="description" content="'.trim(
|
619 |
';
|
620 |
//Image
|
621 |
-
if( intval($this->options['fb_image_show_schema'])==1 && trim($fb_image)!='' ) $html.=' <meta itemprop="image" content="'.trim(
|
622 |
';
|
623 |
-
//
|
624 |
-
if ( intval($this->options['
|
625 |
';
|
626 |
-
|
627 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
628 |
';
|
629 |
// Twitter
|
630 |
$html.=' <!-- Twitter Cards -->
|
631 |
';
|
632 |
//Title
|
633 |
-
if ( intval($this->options['fb_title_show_twitter'])==1 && trim($fb_title)!='' ) $html.=' <meta name="twitter:title" content="'.trim(
|
634 |
';
|
635 |
//URL
|
636 |
-
if ( intval($this->options['fb_url_show_twitter'])==1 && trim($fb_url)!='' ) $html.=' <meta name="twitter:url" content="'.trim(
|
637 |
';
|
638 |
//Description
|
639 |
-
if ( intval($this->options['fb_desc_show_twitter'])==1 && trim($fb_desc)!='' ) $html.=' <meta name="twitter:description" content="'.trim(
|
640 |
';
|
641 |
//Image
|
642 |
-
if( intval($this->options['fb_image_show_twitter'])==1 && trim($fb_image)!='' ) $html.=' <meta name="twitter:image" content="'.trim(
|
643 |
';
|
644 |
//Twitter Card
|
645 |
-
if( intval($this->options['fb_title_show_twitter'])==1 || intval($this->options['fb_url_show_twitter'])==1 || intval($this->options['fb_desc_show_twitter'])==1 || intval($this->options['fb_publisher_show_twitter'])==1 || intval($this->options['fb_image_show_twitter'])==1 ) $html.=' <meta name="twitter:card" content="'.trim(
|
646 |
';
|
647 |
//Author
|
648 |
-
if ( intval($this->options['fb_author_show_twitter'])==1 && trim($fb_author_twitter)!='' ) $html.=' <meta name="twitter:creator" content="@'.trim(
|
649 |
';
|
650 |
//Publisher
|
651 |
-
if ( intval($this->options['fb_publisher_show_twitter'])==1 && trim($fb_publisher_twitteruser)!='') $html.=' <meta name="twitter:site" content="@'.trim(
|
652 |
';
|
653 |
// SEO
|
654 |
$html.=' <!-- SEO -->
|
@@ -659,16 +671,16 @@ class Webdados_FB_Public {
|
|
659 |
//We should use wp_title(), but do we want to? This is only because Business Directory Plugin and they seem to have it covered by now...
|
660 |
}
|
661 |
//URL
|
662 |
-
if ( intval($this->options['fb_url_canonical'])==1 ) $html.=' <link rel="canonical" href="'.trim(
|
663 |
';
|
664 |
//Description
|
665 |
-
if ( intval($this->options['fb_desc_show_meta'])==1 && trim($fb_desc)!='' ) $html.=' <meta name="description" content="'.trim(
|
666 |
';
|
667 |
//Author
|
668 |
-
if (intval($this->options['fb_author_show_meta'])==1 && $fb_author_meta!='') $html.=' <meta name="author" content="'.trim(
|
669 |
';
|
670 |
//Publisher
|
671 |
-
if ( intval($this->options['fb_publisher_show_meta'])==1 ) $html.=' <meta name="publisher" content="'.trim(
|
672 |
';
|
673 |
// SEO
|
674 |
$html.=' <!-- Misc. tags -->
|
@@ -676,7 +688,7 @@ class Webdados_FB_Public {
|
|
676 |
foreach ($fb_additional_tags as $type => $tags) {
|
677 |
foreach($tags as $tag => $values) {
|
678 |
foreach($values as $value) {
|
679 |
-
$html.=' <meta '.$type.'="'.str_replace('_', ':', trim($tag)).'" content="'.trim(
|
680 |
';
|
681 |
}
|
682 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Facebook Open Graph, Google+ and Twitter Card Tags
|
4 |
+
* @version 2.2.1
|
5 |
*/
|
6 |
|
7 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
113 |
global $post;
|
114 |
// Title
|
115 |
//It's a Post or a Page or an attachment page - It can also be the homepage if it's set as a page
|
116 |
+
$fb_title = wp_strip_all_tags( stripslashes( $post->post_title ), true );
|
117 |
//SubHeading
|
118 |
if ( isset($this->options['fb_show_subheading']) && intval($this->options['fb_show_subheading'])==1 && $webdados_fb->is_subheading_plugin_active() ) {
|
119 |
if (isset($this->options['fb_subheading_position']) && $this->options['fb_subheading_position']=='before' ) {
|
183 |
$current_view_object = $wpbdp->dispatcher->current_view_object();
|
184 |
switch( $bdp_action ) {
|
185 |
case 'show_listing':
|
186 |
+
$fb_title = trim( wp_strip_all_tags( stripslashes( $this->post->post_title ), true ).' - '.$fb_title, ' -' );
|
187 |
$fb_set_title_tag = 1;
|
188 |
$fb_url = get_permalink($this->post->ID);
|
189 |
if ( trim($this->post->post_excerpt)!='' ) {
|
263 |
} else {
|
264 |
|
265 |
//Other pages - Defaults
|
266 |
+
$fb_title = wp_strip_all_tags( stripslashes( get_bloginfo( 'name' ) ), true );
|
267 |
$fb_url = ( ( !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https://' : 'http://' ).$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //Not really canonical but will work for now
|
268 |
$fb_image = trim( $this->options['fb_image'] );
|
269 |
|
277 |
|
278 |
//Category
|
279 |
if ( is_category() ) {
|
280 |
+
$fb_title = wp_strip_all_tags( stripslashes( single_cat_title( '', false ) ), true );
|
281 |
$term = $wp_query->get_queried_object();
|
282 |
$fb_url = get_term_link( $term, $term->taxonomy );
|
283 |
+
$cat_desc = trim( wp_strip_all_tags( stripslashes( category_description() ), true ) );
|
284 |
if ( trim($cat_desc)!='' ) $fb_desc = $cat_desc;
|
285 |
} else {
|
286 |
if ( is_tag() ) {
|
287 |
+
$fb_title = wp_strip_all_tags( stripslashes( single_tag_title( '', false ) ), true );
|
288 |
$term = $wp_query->get_queried_object();
|
289 |
$fb_url = get_term_link( $term, $term->taxonomy );
|
290 |
+
$tag_desc = trim( wp_strip_all_tags( stripslashes( tag_description() ), true ) );
|
291 |
if ( trim($tag_desc)!='' ) $fb_desc = $tag_desc;
|
292 |
} else {
|
293 |
if (is_tax()) {
|
294 |
+
$fb_title = wp_strip_all_tags( stripslashes( single_term_title( '', false ) ), true );
|
295 |
$term = $wp_query->get_queried_object();
|
296 |
$fb_url = get_term_link($term, $term->taxonomy);
|
297 |
+
$tax_desc = trim( wp_strip_all_tags( stripslashes( term_description() ), true ) );
|
298 |
if ( trim($tax_desc)!='' ) $fb_desc = $tax_desc;
|
299 |
//WooCommerce
|
300 |
if ( $webdados_fb->is_woocommerce_active() && intval($this->options['fb_wc_usecategthumb'])==1 && is_product_category() ) {
|
308 |
}
|
309 |
} else {
|
310 |
if ( is_search() ) {
|
311 |
+
$fb_title = wp_strip_all_tags( stripslashes( __('Search for', 'wonderm00ns-simple-facebook-open-graph-tags').' "'.get_search_query().'"' ), true );
|
312 |
$fb_url = get_search_link();
|
313 |
} else {
|
314 |
if (is_author()) {
|
315 |
+
$fb_title = wp_strip_all_tags( stripslashes( get_the_author_meta('display_name', get_query_var('author') ) ), true );
|
316 |
$fb_url = get_author_posts_url( get_query_var('author'), get_query_var('author_name') );
|
317 |
} else {
|
318 |
if ( is_archive() ) {
|
319 |
if ( is_day() ) {
|
320 |
+
$fb_title = wp_strip_all_tags( stripslashes( get_query_var( 'day' ) . ' ' .single_month_title( ' ', false ) . ' ' . __( 'Archives', 'wonderm00ns-simple-facebook-open-graph-tags' ) ), true );
|
321 |
$fb_url = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
|
322 |
} else {
|
323 |
if ( is_month() ) {
|
324 |
+
$fb_title = wp_strip_all_tags( stripslashes( single_month_title( ' ', false ) . ' ' . __( 'Archives', 'wonderm00ns-simple-facebook-open-graph-tags' ) ), true );
|
325 |
$fb_url = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
|
326 |
} else {
|
327 |
if ( is_year() ) {
|
328 |
+
$fb_title = wp_strip_all_tags( stripslashes( get_query_var( 'year' ) . ' ' . __( 'Archives', 'wonderm00ns-simple-facebook-open-graph-tags' ) ), true );
|
329 |
$fb_url = get_year_link( get_query_var( 'year' ) );
|
330 |
}
|
331 |
}
|
549 |
$html.=' <!-- Facebook Open Graph -->
|
550 |
';
|
551 |
//Locale
|
552 |
+
if ( intval($this->options['fb_locale_show'])==1 ) $html.=' <meta property="og:locale" content="'.esc_attr(trim( trim($this->options['fb_locale'])!='' ? trim($this->options['fb_locale']) : $webdados_fb->get_locale() )).'"/>
|
553 |
';
|
554 |
//Site name
|
555 |
+
if ( intval($this->options['fb_sitename_show'])==1 ) $html.=' <meta property="og:site_name" content="'.esc_attr(trim(get_bloginfo('name' ))).'"/>
|
556 |
';
|
557 |
//Title
|
558 |
+
if ( intval($this->options['fb_title_show'])==1 && trim($fb_title)!='' ) $html.=' <meta property="og:title" content="'.esc_attr(trim($fb_title)).'"/>
|
559 |
';
|
560 |
//URL
|
561 |
+
if ( intval($this->options['fb_url_show'])==1 && trim($fb_url)!='' ) $html.=' <meta property="og:url" content="'.esc_attr(trim($fb_url)).'"/>
|
562 |
';
|
563 |
//Type
|
564 |
+
if ( intval($this->options['fb_type_show'])==1 && trim($fb_type)!='' ) $html.=' <meta property="og:type" content="'.esc_attr(trim($fb_type)).'"/>
|
565 |
';
|
566 |
//Description
|
567 |
+
if ( intval($this->options['fb_desc_show'])==1 && trim($fb_desc)!='' ) $html.=' <meta property="og:description" content="'.esc_attr(trim($fb_desc)).'"/>
|
568 |
';
|
569 |
//Image
|
570 |
+
if( intval($this->options['fb_image_show'])==1 && trim($fb_image)!='' ) $html.=' <meta property="og:image" content="'.esc_attr(trim($fb_image)).'"/>
|
571 |
';
|
572 |
//Additional Images
|
573 |
if( intval($this->options['fb_image_show'])==1 && isset($fb_image_additional) && is_array($fb_image_additional) && count($fb_image_additional)>0 ) {
|
574 |
foreach ($fb_image_additional as $fb_image_additional_temp) {
|
575 |
if ( isset($fb_image_additional_temp['fb_image']) && trim($fb_image_additional_temp['fb_image'])!='' ) {
|
576 |
+
$html.=' <meta property="og:image" content="'.esc_attr(trim($fb_image_additional_temp['fb_image'])).'"/>
|
577 |
';
|
578 |
}
|
579 |
}
|
580 |
} else {
|
581 |
//Image Size - We only show the image size if we only have one image
|
582 |
+
if( intval($this->options['fb_image_size_show'])==1 && isset($fb_image_size) && is_array($fb_image_size) ) $html.=' <meta property="og:image:width" content="'.esc_attr(intval($fb_image_size[0])).'"/>
|
583 |
+
<meta property="og:image:height" content="'.esc_attr(intval($fb_image_size[1])).'"/>
|
584 |
';
|
585 |
}
|
586 |
//Dates
|
587 |
+
if ( intval($this->options['fb_article_dates_show'])==1 && trim($fb_article_pub_date)!='' ) $html.=' <meta property="article:published_time" content="'.esc_attr(trim($fb_article_pub_date)).'"/>
|
588 |
';
|
589 |
+
if ( intval($this->options['fb_article_dates_show'])==1 && trim($fb_article_mod_date)!='') $html.=' <meta property="article:modified_time" content="'.esc_attr(trim($fb_article_mod_date)).'" />
|
590 |
+
<meta property="og:updated_time" content="'.esc_attr(trim($fb_article_mod_date)).'" />
|
591 |
';
|
592 |
//Sections
|
593 |
if (intval($this->options['fb_article_sections_show'])==1 && isset($fb_sections) && is_array($fb_sections) && count($fb_sections)>0) {
|
594 |
foreach($fb_sections as $fb_section) {
|
595 |
+
$html.=' <meta property="article:section" content="'.esc_attr(trim($fb_section)).'"/>
|
596 |
';
|
597 |
}
|
598 |
}
|
599 |
//Author
|
600 |
+
if ( intval($this->options['fb_author_show'])==1 && $fb_author!='') $html.=' <meta property="article:author" content="'.esc_attr(trim($fb_author)).'"/>
|
601 |
';
|
602 |
//Publisher
|
603 |
+
if ( intval($this->options['fb_publisher_show'])==1 && trim($fb_publisher)!='') $html.=' <meta property="article:publisher" content="'.esc_attr(trim($fb_publisher)).'"/>
|
604 |
';
|
605 |
//App ID
|
606 |
+
if ( intval($this->options['fb_app_id_show'])==1 && trim($fb_app_id)!='' ) $html.=' <meta property="fb:app_id" content="'.esc_attr(trim($fb_app_id)).'"/>
|
607 |
';
|
608 |
//Admins
|
609 |
+
if ( intval($this->options['fb_admin_id_show'])==1 && trim($this->options['fb_admin_id'])!='' ) $html.=' <meta property="fb:admins" content="'.esc_attr(trim($this->options['fb_admin_id'])).'"/>
|
610 |
';
|
611 |
// Schema
|
612 |
$html.=' <!-- Google+ / Schema.org -->
|
613 |
';
|
614 |
//Title
|
615 |
+
if ( intval($this->options['fb_title_show_schema'])==1 && trim($fb_title)!='' ) $html.=' <meta itemprop="name" content="'.esc_attr(trim($fb_title)).'"/>
|
616 |
+
<meta itemprop="headline" content="'.esc_attr(trim($fb_title)).'"/>
|
617 |
';
|
618 |
//Description
|
619 |
+
if ( intval($this->options['fb_desc_show_schema'])==1 && trim($fb_desc)!='' ) $html.=' <meta itemprop="description" content="'.esc_attr(trim($fb_desc)).'"/>
|
620 |
';
|
621 |
//Image
|
622 |
+
if( intval($this->options['fb_image_show_schema'])==1 && trim($fb_image)!='' ) $html.=' <meta itemprop="image" content="'.esc_attr(trim($fb_image)).'"/>
|
623 |
';
|
624 |
+
//Dates
|
625 |
+
if ( intval($this->options['fb_article_dates_show_schema'])==1 && trim($fb_article_pub_date)!='' ) $html.=' <meta itemprop="datePublished" content="'.substr(esc_attr(trim($fb_article_pub_date)),0,10).'"/>
|
626 |
';
|
627 |
+
if ( intval($this->options['fb_article_dates_show_schema'])==1 && trim($fb_article_mod_date)!='') $html.=' <meta itemprop="dateModified" content="'.esc_attr(trim($fb_article_mod_date)).'" />
|
628 |
+
';
|
629 |
+
//Author - Link (no longer used)
|
630 |
+
if ( intval($this->options['fb_author_show_linkrelgp'])==1 && trim($fb_author_linkrelgp)!='') $html.=' <link rel="author" href="'.esc_attr(trim($fb_author_linkrelgp)).'"/>
|
631 |
+
';
|
632 |
+
//Author - Name
|
633 |
+
if (intval($this->options['fb_author_show_schema'])==1 && $fb_author_meta!='') $html.=' <meta itemprop="author" content="'.esc_attr(trim($fb_author_meta)).'"/>
|
634 |
+
';
|
635 |
+
//Publisher - Link
|
636 |
+
if ( intval($this->options['fb_publisher_show_schema'])==1 && trim($fb_publisher_schema)!='') $html.=' <link rel="publisher" href="'.esc_attr(trim($fb_publisher_schema)).'"/>
|
637 |
+
';
|
638 |
+
//Publisher- Name - The attribute publisher.itemtype has an invalid value
|
639 |
+
if ( intval($this->options['fb_publisher_show_schema'])==1 ) $html.=' <!--<meta itemprop="publisher" content="'.esc_attr(trim(get_bloginfo('name' ))).'"/>--> <!-- To solve: The attribute publisher.itemtype has an invalid value -->
|
640 |
';
|
641 |
// Twitter
|
642 |
$html.=' <!-- Twitter Cards -->
|
643 |
';
|
644 |
//Title
|
645 |
+
if ( intval($this->options['fb_title_show_twitter'])==1 && trim($fb_title)!='' ) $html.=' <meta name="twitter:title" content="'.esc_attr(trim($fb_title)).'"/>
|
646 |
';
|
647 |
//URL
|
648 |
+
if ( intval($this->options['fb_url_show_twitter'])==1 && trim($fb_url)!='' ) $html.=' <meta name="twitter:url" content="'.esc_attr(trim($fb_url)).'"/>
|
649 |
';
|
650 |
//Description
|
651 |
+
if ( intval($this->options['fb_desc_show_twitter'])==1 && trim($fb_desc)!='' ) $html.=' <meta name="twitter:description" content="'.esc_attr(trim($fb_desc)).'"/>
|
652 |
';
|
653 |
//Image
|
654 |
+
if( intval($this->options['fb_image_show_twitter'])==1 && trim($fb_image)!='' ) $html.=' <meta name="twitter:image" content="'.esc_attr(trim($fb_image)).'"/>
|
655 |
';
|
656 |
//Twitter Card
|
657 |
+
if( intval($this->options['fb_title_show_twitter'])==1 || intval($this->options['fb_url_show_twitter'])==1 || intval($this->options['fb_desc_show_twitter'])==1 || intval($this->options['fb_publisher_show_twitter'])==1 || intval($this->options['fb_image_show_twitter'])==1 ) $html.=' <meta name="twitter:card" content="'.esc_attr(trim($this->options['fb_twitter_card_type'])).'"/>
|
658 |
';
|
659 |
//Author
|
660 |
+
if ( intval($this->options['fb_author_show_twitter'])==1 && trim($fb_author_twitter)!='' ) $html.=' <meta name="twitter:creator" content="@'.esc_attr(trim( $fb_author_twitter )).'"/>
|
661 |
';
|
662 |
//Publisher
|
663 |
+
if ( intval($this->options['fb_publisher_show_twitter'])==1 && trim($fb_publisher_twitteruser)!='') $html.=' <meta name="twitter:site" content="@'.esc_attr(trim($fb_publisher_twitteruser)).'"/>
|
664 |
';
|
665 |
// SEO
|
666 |
$html.=' <!-- SEO -->
|
671 |
//We should use wp_title(), but do we want to? This is only because Business Directory Plugin and they seem to have it covered by now...
|
672 |
}
|
673 |
//URL
|
674 |
+
if ( intval($this->options['fb_url_canonical'])==1 ) $html.=' <link rel="canonical" href="'.esc_attr(trim($fb_url)).'"/>
|
675 |
';
|
676 |
//Description
|
677 |
+
if ( intval($this->options['fb_desc_show_meta'])==1 && trim($fb_desc)!='' ) $html.=' <meta name="description" content="'.esc_attr(trim($fb_desc)).'"/>
|
678 |
';
|
679 |
//Author
|
680 |
+
if (intval($this->options['fb_author_show_meta'])==1 && $fb_author_meta!='') $html.=' <meta name="author" content="'.esc_attr(trim($fb_author_meta)).'"/>
|
681 |
';
|
682 |
//Publisher
|
683 |
+
if ( intval($this->options['fb_publisher_show_meta'])==1 ) $html.=' <meta name="publisher" content="'.esc_attr(trim(get_bloginfo('name' ))).'"/>
|
684 |
';
|
685 |
// SEO
|
686 |
$html.=' <!-- Misc. tags -->
|
688 |
foreach ($fb_additional_tags as $type => $tags) {
|
689 |
foreach($tags as $tag => $values) {
|
690 |
foreach($values as $value) {
|
691 |
+
$html.=' <meta '.$type.'="'.str_replace('_', ':', trim($tag)).'" content="'.esc_attr(trim($value)).'"/>
|
692 |
';
|
693 |
}
|
694 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9.1
|
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 |
|
@@ -56,9 +56,12 @@ Our settings page is discreetly kept under "Options", as it should, instead of t
|
|
56 |
= The (Google+) Schema.org Tags that this plugin inserts are: =
|
57 |
|
58 |
* **name**: Same as `og:title`.
|
|
|
59 |
* **description**: Same as `og:description`.
|
60 |
* **image**: Same as `og:image`.
|
61 |
-
* **author**: From the user (post author)
|
|
|
|
|
62 |
* **publisher**: The website Google+ Page URL.
|
63 |
|
64 |
= Other Tags: =
|
@@ -147,6 +150,10 @@ We DO NOT provide email support for this plugin. If you send us an email asking
|
|
147 |
|
148 |
== Changelog ==
|
149 |
|
|
|
|
|
|
|
|
|
150 |
= 2.2 =
|
151 |
* New "Tools" panel on the settings page
|
152 |
* Tool to clear all the plugin transients, thus resetting size caching for all images (use it only )
|
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
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 4.9.1
|
7 |
+
Stable tag: 2.2.1
|
8 |
|
9 |
Inserts Facebook Open Graph, Google+/Schema.org, Twitter and SEO Meta Tags into your WordPress Website for more efficient sharing results.
|
10 |
|
56 |
= The (Google+) Schema.org Tags that this plugin inserts are: =
|
57 |
|
58 |
* **name**: Same as `og:title`.
|
59 |
+
* **headline**: Same as `og:title`.
|
60 |
* **description**: Same as `og:description`.
|
61 |
* **image**: Same as `og:image`.
|
62 |
+
* **author**: From the user (post author) Display Name.
|
63 |
+
* **datePublished**: Article published date (for posts only)
|
64 |
+
* **dateModified**: Article modified time (for posts only)
|
65 |
* **publisher**: The website Google+ Page URL.
|
66 |
|
67 |
= Other Tags: =
|
150 |
|
151 |
== Changelog ==
|
152 |
|
153 |
+
= 2.2.1 =
|
154 |
+
* Added the Schema.org headline, author, datePublished and dateModified tags
|
155 |
+
* Removed some unnecessary / duplicated `esc_attr` calls
|
156 |
+
|
157 |
= 2.2 =
|
158 |
* New "Tools" panel on the settings page
|
159 |
* Tool to clear all the plugin transients, thus resetting size caching for all images (use it only )
|
wonderm00n-open-graph.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Facebook Open Graph, Google+ and Twitter Card Tags
|
4 |
-
* @version 2.2
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
|
8 |
Plugin URI: https://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
|
9 |
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.
|
10 |
|
11 |
-
Version: 2.2
|
12 |
Author: Webdados
|
13 |
Author URI: https://www.webdados.pt
|
14 |
Text Domain: wonderm00ns-simple-facebook-open-graph-tags
|
@@ -18,7 +18,7 @@ WC tested up to: 3.2.6
|
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
20 |
|
21 |
-
define( 'WEBDADOS_FB_VERSION', '2.2' );
|
22 |
define( 'WEBDADOS_FB_PLUGIN_NAME', 'Facebook Open Graph, Google+ and Twitter Card Tags' );
|
23 |
define( 'WEBDADOS_FB_W', 1200 );
|
24 |
define( 'WEBDADOS_FB_H', 630 );
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Facebook Open Graph, Google+ and Twitter Card Tags
|
4 |
+
* @version 2.2.1
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Facebook Open Graph, Google+ and Twitter Card Tags
|
8 |
Plugin URI: https://www.webdados.pt/produtos-e-servicos/internet/desenvolvimento-wordpress/facebook-open-graph-meta-tags-wordpress/
|
9 |
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.
|
10 |
|
11 |
+
Version: 2.2.1
|
12 |
Author: Webdados
|
13 |
Author URI: https://www.webdados.pt
|
14 |
Text Domain: wonderm00ns-simple-facebook-open-graph-tags
|
18 |
|
19 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
20 |
|
21 |
+
define( 'WEBDADOS_FB_VERSION', '2.2.1' );
|
22 |
define( 'WEBDADOS_FB_PLUGIN_NAME', 'Facebook Open Graph, Google+ and Twitter Card Tags' );
|
23 |
define( 'WEBDADOS_FB_W', 1200 );
|
24 |
define( 'WEBDADOS_FB_H', 630 );
|