Version Description
- Fix : Google analytics tracking code removed some characters
- Fix : Send email (SEO report)
- Fix : Query duplicate meta
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 3.6.4 |
Comparing to | |
See all releases |
Code changes from version 3.6.3 to 3.6.4
- css/metaseo_admin.css +4 -0
- inc/class.metaseo-admin.php +17 -8
- inc/class.metaseo-content-list-table.php +6 -3
- inc/class.metaseo-dashboard.php +4 -4
- inc/class.metaseo-front_end.php +5 -4
- inc/class.metaseo-image-list-table.php +3 -0
- inc/class.metaseo-metabox.php +10 -7
- inc/class.metaseo-opengraph.php +60 -46
- languages/wp-meta-seo-en_US.mo +0 -0
- readme.txt +7 -2
- wp-meta-seo.php +98 -65
css/metaseo_admin.css
CHANGED
@@ -682,4 +682,8 @@ span.wpms-seoImgRemove{
|
|
682 |
|
683 |
.tr_home_text.hide{
|
684 |
display: none;
|
|
|
|
|
|
|
|
|
685 |
}
|
682 |
|
683 |
.tr_home_text.hide{
|
684 |
display: none;
|
685 |
+
}
|
686 |
+
|
687 |
+
#wpmseo_meta {
|
688 |
+
display: block !important;
|
689 |
}
|
inc/class.metaseo-admin.php
CHANGED
@@ -1032,13 +1032,17 @@ class MetaSeoAdmin
|
|
1032 |
$img_wrong_alt = false;
|
1033 |
foreach ($tags as $order => $tag) {
|
1034 |
$src = $tag->getAttribute('src');
|
1035 |
-
$
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
if (!
|
1040 |
-
|
1041 |
-
|
|
|
|
|
|
|
|
|
1042 |
$img_wrong = true;
|
1043 |
}
|
1044 |
}
|
@@ -2729,7 +2733,12 @@ class MetaSeoAdmin
|
|
2729 |
);
|
2730 |
}
|
2731 |
if (isset($_POST['_metaseo_ga_disconnect'])) {
|
2732 |
-
|
|
|
|
|
|
|
|
|
|
|
2733 |
$gaDisconnect = get_option('_metaseo_ggtracking_disconnect_settings');
|
2734 |
if (is_array($gaDisconnect)) {
|
2735 |
$this->gaDisconnect = array_merge(
|
1032 |
$img_wrong_alt = false;
|
1033 |
foreach ($tags as $order => $tag) {
|
1034 |
$src = $tag->getAttribute('src');
|
1035 |
+
$imgpath = str_replace(site_url(), ABSPATH, $src);
|
1036 |
+
if (!file_exists($imgpath)) {
|
1037 |
+
continue;
|
1038 |
+
}
|
1039 |
+
if (!list($width_origin, $height_origin) = getimagesize($imgpath)) {
|
1040 |
+
continue;
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
if (!empty($width_origin) && !empty($height_origin)) {
|
1044 |
+
if (((int)$width_origin != (int)$tag->getAttribute('width'))
|
1045 |
+
|| ((int)$height_origin != (int)$tag->getAttribute('height'))) {
|
1046 |
$img_wrong = true;
|
1047 |
}
|
1048 |
}
|
2733 |
);
|
2734 |
}
|
2735 |
if (isset($_POST['_metaseo_ga_disconnect'])) {
|
2736 |
+
$_metaseo_ga_disconnect = $_POST['_metaseo_ga_disconnect'];
|
2737 |
+
$_metaseo_ga_disconnect['wpmsga_code_tracking'] = stripslashes($_metaseo_ga_disconnect['wpmsga_code_tracking']);
|
2738 |
+
update_option(
|
2739 |
+
'_metaseo_ggtracking_disconnect_settings',
|
2740 |
+
$_metaseo_ga_disconnect
|
2741 |
+
);
|
2742 |
$gaDisconnect = get_option('_metaseo_ggtracking_disconnect_settings');
|
2743 |
if (is_array($gaDisconnect)) {
|
2744 |
$this->gaDisconnect = array_merge(
|
inc/class.metaseo-content-list-table.php
CHANGED
@@ -348,10 +348,11 @@ class MetaSeoContentListTable extends WP_List_Table
|
|
348 |
if (isset($_GET['wpms_duplicate_meta']) && $_GET['wpms_duplicate_meta'] != 'none') {
|
349 |
if ($_GET['wpms_duplicate_meta'] == 'duplicate_title') {
|
350 |
$where[] = "mt.meta_key = '_metaseo_metatitle'";
|
351 |
-
$where[] = "mt.meta_value
|
|
|
352 |
} elseif ($_GET['wpms_duplicate_meta'] == 'duplicate_desc') {
|
353 |
$where[] = "md.meta_key = '_metaseo_metadesc'";
|
354 |
-
$where[] = "md.meta_value
|
355 |
}
|
356 |
}
|
357 |
|
@@ -369,13 +370,14 @@ class MetaSeoContentListTable extends WP_List_Table
|
|
369 |
|
370 |
$query = "SELECT DISTINCT ID, post_title, post_name, post_type, post_status,
|
371 |
mt.meta_value AS metatitle, md.meta_value AS metadesc ,mk.meta_value AS metakeywords "
|
372 |
-
. " FROM $wpdb->posts
|
373 |
. " LEFT JOIN (SELECT * FROM $wpdb->postmeta WHERE meta_key = '_metaseo_metatitle')
|
374 |
mt ON mt.post_id = $wpdb->posts.ID "
|
375 |
. " LEFT JOIN (SELECT * FROM $wpdb->postmeta WHERE meta_key = '_metaseo_metadesc')
|
376 |
md ON md.post_id = $wpdb->posts.ID "
|
377 |
. " LEFT JOIN (SELECT * FROM $wpdb->postmeta WHERE meta_key = '_metaseo_metakeywords')
|
378 |
mk ON mk.post_id = $wpdb->posts.ID ";
|
|
|
379 |
// query post by lang with polylang plugin
|
380 |
if (is_plugin_active(WPMSEO_ADDON_FILENAME) && is_plugin_active('polylang/polylang.php')) {
|
381 |
if (isset($_GET['wpms_lang_list']) && $_GET['wpms_lang_list'] != '0') {
|
@@ -395,6 +397,7 @@ class MetaSeoContentListTable extends WP_List_Table
|
|
395 |
}
|
396 |
|
397 |
$query .= " WHERE " . implode(' AND ', $where) . $orderStr;
|
|
|
398 |
if (!empty($_REQUEST['metaseo_posts_per_page'])) {
|
399 |
$_per_page = intval($_REQUEST['metaseo_posts_per_page']);
|
400 |
} else {
|
348 |
if (isset($_GET['wpms_duplicate_meta']) && $_GET['wpms_duplicate_meta'] != 'none') {
|
349 |
if ($_GET['wpms_duplicate_meta'] == 'duplicate_title') {
|
350 |
$where[] = "mt.meta_key = '_metaseo_metatitle'";
|
351 |
+
$where[] = "mt.meta_value IN (SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key='_metaseo_metatitle' GROUP BY meta_value HAVING COUNT(*) >= 2)";
|
352 |
+
|
353 |
} elseif ($_GET['wpms_duplicate_meta'] == 'duplicate_desc') {
|
354 |
$where[] = "md.meta_key = '_metaseo_metadesc'";
|
355 |
+
$where[] = "md.meta_value IN (SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key='_metaseo_metadesc' GROUP BY meta_value HAVING COUNT(*) >= 2)";
|
356 |
}
|
357 |
}
|
358 |
|
370 |
|
371 |
$query = "SELECT DISTINCT ID, post_title, post_name, post_type, post_status,
|
372 |
mt.meta_value AS metatitle, md.meta_value AS metadesc ,mk.meta_value AS metakeywords "
|
373 |
+
. " FROM $wpdb->posts"
|
374 |
. " LEFT JOIN (SELECT * FROM $wpdb->postmeta WHERE meta_key = '_metaseo_metatitle')
|
375 |
mt ON mt.post_id = $wpdb->posts.ID "
|
376 |
. " LEFT JOIN (SELECT * FROM $wpdb->postmeta WHERE meta_key = '_metaseo_metadesc')
|
377 |
md ON md.post_id = $wpdb->posts.ID "
|
378 |
. " LEFT JOIN (SELECT * FROM $wpdb->postmeta WHERE meta_key = '_metaseo_metakeywords')
|
379 |
mk ON mk.post_id = $wpdb->posts.ID ";
|
380 |
+
|
381 |
// query post by lang with polylang plugin
|
382 |
if (is_plugin_active(WPMSEO_ADDON_FILENAME) && is_plugin_active('polylang/polylang.php')) {
|
383 |
if (isset($_GET['wpms_lang_list']) && $_GET['wpms_lang_list'] != '0') {
|
397 |
}
|
398 |
|
399 |
$query .= " WHERE " . implode(' AND ', $where) . $orderStr;
|
400 |
+
|
401 |
if (!empty($_REQUEST['metaseo_posts_per_page'])) {
|
402 |
$_per_page = intval($_REQUEST['metaseo_posts_per_page']);
|
403 |
} else {
|
inc/class.metaseo-dashboard.php
CHANGED
@@ -797,10 +797,10 @@ class MetaSeoDashboard
|
|
797 |
|
798 |
$options_dashboard = get_option('options_dashboard');
|
799 |
$results = $options_dashboard['image_meta'];
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
}
|
805 |
|
806 |
wp_send_json($response);
|
797 |
|
798 |
$options_dashboard = get_option('options_dashboard');
|
799 |
$results = $options_dashboard['image_meta'];
|
800 |
+
|
801 |
+
$results['status'] = true;
|
802 |
+
wp_send_json($results);
|
803 |
+
|
804 |
}
|
805 |
|
806 |
wp_send_json($response);
|
inc/class.metaseo-front_end.php
CHANGED
@@ -58,7 +58,7 @@ class MetaSeoFront
|
|
58 |
|
59 |
$this->gaDisconnect = array(
|
60 |
'wpms_ga_uax_reference' => '',
|
61 |
-
'wpmsga_dash_tracking_type' => '
|
62 |
'wpmsga_code_tracking' => ''
|
63 |
);
|
64 |
$gaDisconnect = get_option('_metaseo_ggtracking_disconnect_settings');
|
@@ -86,17 +86,17 @@ class MetaSeoFront
|
|
86 |
|
87 |
$google_alanytics = get_option('wpms_google_alanytics');
|
88 |
$traking_mode = $this->ga_tracking['wpmsga_dash_tracking'];
|
89 |
-
$traking_type = $this->ga_tracking['wpmsga_dash_tracking_type'];
|
90 |
if ($traking_mode > 0) {
|
91 |
if (empty($google_alanytics['tableid_jail'])) {
|
92 |
-
if (!empty($this->gaDisconnect['wpmsga_code_tracking'])) {
|
93 |
echo '<script type="text/javascript">';
|
94 |
-
echo strip_tags($this->gaDisconnect['wpmsga_code_tracking'], '</script>');
|
95 |
echo '</script>';
|
96 |
} else {
|
97 |
if (empty($this->gaDisconnect['wpms_ga_uax_reference'])) {
|
98 |
return false;
|
99 |
}
|
|
|
100 |
if ($traking_type == "classic") {
|
101 |
echo "\n<!-- BEGIN WPMSGA v" . WPMSEO_VERSION . " Classic Tracking
|
102 |
- https://wordpress.org/plugins/wp-meta-seo/ -->\n";
|
@@ -109,6 +109,7 @@ class MetaSeoFront
|
|
109 |
}
|
110 |
}
|
111 |
} else {
|
|
|
112 |
if ($traking_type == "classic") {
|
113 |
echo "\n<!-- Classic Tracking - https://wordpress.org/plugins/wp-meta-seo/ -->\n";
|
114 |
if ($this->ga_tracking['wpmsga_event_tracking']) {
|
58 |
|
59 |
$this->gaDisconnect = array(
|
60 |
'wpms_ga_uax_reference' => '',
|
61 |
+
'wpmsga_dash_tracking_type' => 'universal',
|
62 |
'wpmsga_code_tracking' => ''
|
63 |
);
|
64 |
$gaDisconnect = get_option('_metaseo_ggtracking_disconnect_settings');
|
86 |
|
87 |
$google_alanytics = get_option('wpms_google_alanytics');
|
88 |
$traking_mode = $this->ga_tracking['wpmsga_dash_tracking'];
|
|
|
89 |
if ($traking_mode > 0) {
|
90 |
if (empty($google_alanytics['tableid_jail'])) {
|
91 |
+
if (!empty(trim($this->gaDisconnect['wpmsga_code_tracking']))) {
|
92 |
echo '<script type="text/javascript">';
|
93 |
+
echo strip_tags(stripslashes($this->gaDisconnect['wpmsga_code_tracking']), '</script>');
|
94 |
echo '</script>';
|
95 |
} else {
|
96 |
if (empty($this->gaDisconnect['wpms_ga_uax_reference'])) {
|
97 |
return false;
|
98 |
}
|
99 |
+
$traking_type = $this->gaDisconnect['wpmsga_dash_tracking_type'];
|
100 |
if ($traking_type == "classic") {
|
101 |
echo "\n<!-- BEGIN WPMSGA v" . WPMSEO_VERSION . " Classic Tracking
|
102 |
- https://wordpress.org/plugins/wp-meta-seo/ -->\n";
|
109 |
}
|
110 |
}
|
111 |
} else {
|
112 |
+
$traking_type = $this->ga_tracking['wpmsga_dash_tracking_type'];
|
113 |
if ($traking_type == "classic") {
|
114 |
echo "\n<!-- Classic Tracking - https://wordpress.org/plugins/wp-meta-seo/ -->\n";
|
115 |
if ($this->ga_tracking['wpmsga_event_tracking']) {
|
inc/class.metaseo-image-list-table.php
CHANGED
@@ -640,6 +640,9 @@ $wpdb->posts WHERE post_status IN ($all_states) AND post_type IN ($post_types) O
|
|
640 |
$i++;
|
641 |
$classes = $alternate;
|
642 |
$img_meta = get_post_meta($rec->ID, '_wp_attachment_metadata', true);
|
|
|
|
|
|
|
643 |
$thumb = wp_get_attachment_image_src($rec->ID, 'thumbnail');
|
644 |
if (!$thumb) {
|
645 |
$thumb_url = $rec->guid;
|
640 |
$i++;
|
641 |
$classes = $alternate;
|
642 |
$img_meta = get_post_meta($rec->ID, '_wp_attachment_metadata', true);
|
643 |
+
if (empty($img_meta['file'])) {
|
644 |
+
continue;
|
645 |
+
}
|
646 |
$thumb = wp_get_attachment_image_src($rec->ID, 'thumbnail');
|
647 |
if (!$thumb) {
|
648 |
$thumb_url = $rec->guid;
|
inc/class.metaseo-metabox.php
CHANGED
@@ -912,13 +912,16 @@ class WPMSEOMetabox extends WPMSEOMeta
|
|
912 |
$img_wrong = false;
|
913 |
foreach ($tags as $order => $tag) {
|
914 |
$src = $tag->getAttribute('src');
|
915 |
-
$
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
if (!
|
920 |
-
|
921 |
-
|
|
|
|
|
|
|
922 |
$img_wrong = true;
|
923 |
}
|
924 |
}
|
912 |
$img_wrong = false;
|
913 |
foreach ($tags as $order => $tag) {
|
914 |
$src = $tag->getAttribute('src');
|
915 |
+
$imgpath = str_replace(site_url(), ABSPATH, $src);
|
916 |
+
if (!file_exists($imgpath)) {
|
917 |
+
continue;
|
918 |
+
}
|
919 |
+
if (!list($width_origin, $height_origin) = getimagesize($imgpath)) {
|
920 |
+
continue;
|
921 |
+
}
|
922 |
+
if (!empty($width_origin) && !empty($height_origin)) {
|
923 |
+
if (((int)$width_origin != (int)$tag->getAttribute('width'))
|
924 |
+
|| ((int)$height_origin != (int)$tag->getAttribute('height'))) {
|
925 |
$img_wrong = true;
|
926 |
}
|
927 |
}
|
inc/class.metaseo-opengraph.php
CHANGED
@@ -8,22 +8,36 @@ defined('ABSPATH') || die('No direct script access allowed!');
|
|
8 |
*/
|
9 |
class MetaSeoOpenGraph
|
10 |
{
|
11 |
-
|
12 |
/**
|
13 |
* Get meta title for title tag
|
14 |
-
* @param $
|
15 |
-
* @
|
|
|
16 |
*/
|
17 |
-
public function getTitle($
|
18 |
{
|
19 |
-
$
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if ($meta_title != maybe_unserialize($meta_title)) {
|
22 |
$meta_title = '';
|
23 |
}
|
24 |
|
25 |
if ($meta_title == '') {
|
26 |
-
$
|
|
|
27 |
}
|
28 |
|
29 |
return $meta_title;
|
@@ -31,16 +45,15 @@ class MetaSeoOpenGraph
|
|
31 |
|
32 |
/**
|
33 |
* Get meta title for meta tag
|
34 |
-
* @param $wp_query
|
35 |
* @param array $settings meta seo settings
|
36 |
* @param string $meta_title meta title
|
37 |
* @return string
|
38 |
*/
|
39 |
-
public function getMetaTitle($
|
40 |
{
|
41 |
$meta_title_esc = esc_attr($meta_title);
|
42 |
// check homepage is a page
|
43 |
-
if (
|
44 |
$meta_title_esc = esc_attr($settings['metaseo_title_home']);
|
45 |
if ($meta_title_esc != maybe_unserialize($meta_title_esc)) {
|
46 |
$meta_title_esc = '';
|
@@ -52,15 +65,15 @@ class MetaSeoOpenGraph
|
|
52 |
|
53 |
/**
|
54 |
* Get meta keyword for meta tag
|
55 |
-
* @param $wp_query
|
56 |
* @param array $settings meta seo settings
|
|
|
57 |
* @return string
|
58 |
*/
|
59 |
-
public function getKeyword($
|
60 |
{
|
61 |
$keywords = '';
|
62 |
if (isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1) {
|
63 |
-
$meta_keywords = get_post_meta($
|
64 |
$keywords = esc_attr($meta_keywords);
|
65 |
}
|
66 |
return $keywords;
|
@@ -68,19 +81,20 @@ class MetaSeoOpenGraph
|
|
68 |
|
69 |
/**
|
70 |
* Get meta description for meta tag
|
71 |
-
* @param $wp_query
|
72 |
* @param array $settings meta seo settings
|
|
|
|
|
73 |
* @return string
|
74 |
*/
|
75 |
-
public function getDesc($
|
76 |
{
|
77 |
-
$meta_description = get_post_meta($
|
78 |
if ($meta_description != maybe_unserialize($meta_description)) {
|
79 |
$meta_description = '';
|
80 |
}
|
81 |
|
82 |
if ($meta_description == '') {
|
83 |
-
$content = strip_shortcodes($
|
84 |
$content = trim(strip_tags($content));
|
85 |
if (strlen($content) > MPMSCAT_DESC_LENGTH) {
|
86 |
$meta_description = substr($content, 0, 316) . ' ...';
|
@@ -88,9 +102,10 @@ class MetaSeoOpenGraph
|
|
88 |
$meta_description = $content;
|
89 |
}
|
90 |
}
|
|
|
91 |
$meta_desc_esc = esc_attr($meta_description);
|
92 |
|
93 |
-
if (get_post_meta($
|
94 |
$meta_desc_esc = esc_attr($settings['metaseo_desc_home']);
|
95 |
if ($meta_desc_esc != maybe_unserialize($meta_desc_esc)) {
|
96 |
$meta_desc_esc = '';
|
@@ -101,13 +116,13 @@ class MetaSeoOpenGraph
|
|
101 |
|
102 |
/**
|
103 |
* Get meta facebook title
|
104 |
-
* @param $wp_query
|
105 |
* @param string $meta_title_esc meta title default
|
|
|
106 |
* @return mixed|string
|
107 |
*/
|
108 |
-
public function getFbtitle($
|
109 |
{
|
110 |
-
$meta_fbtitle = get_post_meta($
|
111 |
if ($meta_fbtitle != maybe_unserialize($meta_fbtitle)) {
|
112 |
$meta_fbtitle = '';
|
113 |
}
|
@@ -121,13 +136,13 @@ class MetaSeoOpenGraph
|
|
121 |
|
122 |
/**
|
123 |
* Get meta facebook description
|
124 |
-
* @param $wp_query
|
125 |
* @param string $meta_desc_esc meta description default
|
|
|
126 |
* @return mixed|string
|
127 |
*/
|
128 |
-
public function getFbdesc($
|
129 |
{
|
130 |
-
$meta_fbdesc = get_post_meta($
|
131 |
if ($meta_fbdesc != maybe_unserialize($meta_fbdesc)) {
|
132 |
$meta_fbdesc = '';
|
133 |
}
|
@@ -141,15 +156,15 @@ class MetaSeoOpenGraph
|
|
141 |
|
142 |
/**
|
143 |
* Get meta facebook image and twiter image
|
144 |
-
* @param $
|
145 |
* @return array
|
146 |
*/
|
147 |
-
public function getImage($
|
148 |
{
|
149 |
-
$meta_twimage = get_post_meta($
|
150 |
-
$meta_fbimage = get_post_meta($
|
151 |
|
152 |
-
$default_image = wp_get_attachment_image_src(get_post_thumbnail_id(
|
153 |
if (empty($meta_twimage) && isset($default_image[0])) {
|
154 |
$meta_twimage = $default_image[0];
|
155 |
}
|
@@ -163,13 +178,13 @@ class MetaSeoOpenGraph
|
|
163 |
|
164 |
/**
|
165 |
* Get meta twiter title
|
166 |
-
* @param $wp_query
|
167 |
* @param string $meta_title_esc meta title default
|
|
|
168 |
* @return string
|
169 |
*/
|
170 |
-
public function getTwtitle($
|
171 |
{
|
172 |
-
$twitter_title = get_post_meta($
|
173 |
if ($twitter_title != maybe_unserialize($twitter_title)) {
|
174 |
$twitter_title = '';
|
175 |
}
|
@@ -184,13 +199,13 @@ class MetaSeoOpenGraph
|
|
184 |
|
185 |
/**
|
186 |
* Get meta twiter description
|
187 |
-
* @param $wp_query
|
188 |
* @param string $meta_desc_esc meta description default
|
|
|
189 |
* @return string
|
190 |
*/
|
191 |
-
public function getTwdesc($
|
192 |
{
|
193 |
-
$twitter_desc = get_post_meta($
|
194 |
if ($twitter_desc != maybe_unserialize($twitter_desc)) {
|
195 |
$twitter_desc = '';
|
196 |
}
|
@@ -340,14 +355,15 @@ class MetaSeoOpenGraph
|
|
340 |
|
341 |
/**
|
342 |
* Get meta facebook admin and twitter site
|
343 |
-
* @param $wp_query
|
344 |
* @param array $settings meta seo settings
|
|
|
345 |
* @return array
|
346 |
*/
|
347 |
-
public function getUserMeta($
|
348 |
{
|
349 |
-
$
|
350 |
-
$
|
|
|
351 |
|
352 |
if ($settings) {
|
353 |
if ($meta_twitter_site == '' && $settings['metaseo_showtwitter'] != '') {
|
@@ -398,7 +414,7 @@ class MetaSeoOpenGraph
|
|
398 |
}
|
399 |
|
400 |
/**
|
401 |
-
* @param $
|
402 |
* @param array $settings meta seo settings
|
403 |
* @param string $meta_twimage meta twiter image
|
404 |
* @param string $meta_twcard meta twiter card
|
@@ -406,7 +422,6 @@ class MetaSeoOpenGraph
|
|
406 |
* @param string $sitename site name
|
407 |
* @param string $meta_twdesc meta twiter description
|
408 |
* @param string $meta_twtitle meta twiter title
|
409 |
-
* @param string $meta_title meta title
|
410 |
* @param string $facebook_admin meta facebook admin
|
411 |
* @param string $meta_fbimage meta facebook image
|
412 |
* @param string $meta_fbdesc meta facebook description
|
@@ -422,7 +437,7 @@ class MetaSeoOpenGraph
|
|
422 |
* @return array
|
423 |
*/
|
424 |
public function getPatterns(
|
425 |
-
$
|
426 |
$settings,
|
427 |
$meta_twimage,
|
428 |
$meta_twcard,
|
@@ -430,7 +445,6 @@ class MetaSeoOpenGraph
|
|
430 |
$sitename,
|
431 |
$meta_twdesc,
|
432 |
$meta_twtitle,
|
433 |
-
$meta_title,
|
434 |
$facebook_admin,
|
435 |
$meta_fbimage,
|
436 |
$meta_fbdesc,
|
@@ -469,8 +483,6 @@ class MetaSeoOpenGraph
|
|
469 |
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
470 |
'<meta name="twitter:title" content="' . $meta_twtitle . '" />',
|
471 |
($meta_twtitle != '' ? true : false)),
|
472 |
-
'_title' => array('/<title.*?\/title>/i', '<title>' . $meta_title . '</title>',
|
473 |
-
($meta_title != '' ? true : false)),
|
474 |
'facebook_admin' => array(
|
475 |
'#<meta property="fb:admins" [^<>]+ ?>#i',
|
476 |
'<meta property="fb:admins" content="' . $facebook_admin . '" />',
|
@@ -524,7 +536,7 @@ class MetaSeoOpenGraph
|
|
524 |
);
|
525 |
}
|
526 |
|
527 |
-
if (get_post_meta($
|
528 |
$patterns['title'] = array(
|
529 |
'#<meta name="title" [^<>]+ ?>#i',
|
530 |
'<meta name="title" content="' . $meta_title_esc . '" />',
|
@@ -598,6 +610,8 @@ class MetaSeoOpenGraph
|
|
598 |
unset($patterns['site_name']);
|
599 |
unset($patterns['og:description']);
|
600 |
unset($patterns['og:title']);
|
|
|
|
|
601 |
}
|
602 |
|
603 |
return $patterns;
|
8 |
*/
|
9 |
class MetaSeoOpenGraph
|
10 |
{
|
|
|
11 |
/**
|
12 |
* Get meta title for title tag
|
13 |
+
* @param boolean $is_shop check is shop
|
14 |
+
* @param int $id id of post
|
15 |
+
* @return mixed|string
|
16 |
*/
|
17 |
+
public function getTitle($is_shop, $id)
|
18 |
{
|
19 |
+
if ( $is_shop ) {
|
20 |
+
$shop = get_post($id);
|
21 |
+
$meta_title = get_post_meta($id, '_metaseo_metatitle', true);
|
22 |
+
if ($meta_title != maybe_unserialize($meta_title)) {
|
23 |
+
$meta_title = '';
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($meta_title == '') {
|
27 |
+
$meta_title = $shop->post_title;
|
28 |
+
}
|
29 |
+
|
30 |
+
return $meta_title;
|
31 |
+
}
|
32 |
+
|
33 |
+
$meta_title = get_post_meta($id, '_metaseo_metatitle', true);
|
34 |
if ($meta_title != maybe_unserialize($meta_title)) {
|
35 |
$meta_title = '';
|
36 |
}
|
37 |
|
38 |
if ($meta_title == '') {
|
39 |
+
$post = get_post($id);
|
40 |
+
$meta_title = $post->post_title;
|
41 |
}
|
42 |
|
43 |
return $meta_title;
|
45 |
|
46 |
/**
|
47 |
* Get meta title for meta tag
|
|
|
48 |
* @param array $settings meta seo settings
|
49 |
* @param string $meta_title meta title
|
50 |
* @return string
|
51 |
*/
|
52 |
+
public function getMetaTitle($settings, $meta_title)
|
53 |
{
|
54 |
$meta_title_esc = esc_attr($meta_title);
|
55 |
// check homepage is a page
|
56 |
+
if ($meta_title == '' && is_front_page()) {
|
57 |
$meta_title_esc = esc_attr($settings['metaseo_title_home']);
|
58 |
if ($meta_title_esc != maybe_unserialize($meta_title_esc)) {
|
59 |
$meta_title_esc = '';
|
65 |
|
66 |
/**
|
67 |
* Get meta keyword for meta tag
|
|
|
68 |
* @param array $settings meta seo settings
|
69 |
+
* @param int $id id of post
|
70 |
* @return string
|
71 |
*/
|
72 |
+
public function getKeyword($settings, $id)
|
73 |
{
|
74 |
$keywords = '';
|
75 |
if (isset($settings['metaseo_showkeywords']) && $settings['metaseo_showkeywords'] == 1) {
|
76 |
+
$meta_keywords = get_post_meta($id, '_metaseo_metakeywords', true);
|
77 |
$keywords = esc_attr($meta_keywords);
|
78 |
}
|
79 |
return $keywords;
|
81 |
|
82 |
/**
|
83 |
* Get meta description for meta tag
|
|
|
84 |
* @param array $settings meta seo settings
|
85 |
+
* @param int $id id of post
|
86 |
+
* @param string $content content of post
|
87 |
* @return string
|
88 |
*/
|
89 |
+
public function getDesc($settings, $id, $content)
|
90 |
{
|
91 |
+
$meta_description = get_post_meta($id, '_metaseo_metadesc', true);
|
92 |
if ($meta_description != maybe_unserialize($meta_description)) {
|
93 |
$meta_description = '';
|
94 |
}
|
95 |
|
96 |
if ($meta_description == '') {
|
97 |
+
$content = strip_shortcodes($content);
|
98 |
$content = trim(strip_tags($content));
|
99 |
if (strlen($content) > MPMSCAT_DESC_LENGTH) {
|
100 |
$meta_description = substr($content, 0, 316) . ' ...';
|
102 |
$meta_description = $content;
|
103 |
}
|
104 |
}
|
105 |
+
|
106 |
$meta_desc_esc = esc_attr($meta_description);
|
107 |
|
108 |
+
if (get_post_meta($id, '_metaseo_metadesc', true) == '' && is_front_page()) {
|
109 |
$meta_desc_esc = esc_attr($settings['metaseo_desc_home']);
|
110 |
if ($meta_desc_esc != maybe_unserialize($meta_desc_esc)) {
|
111 |
$meta_desc_esc = '';
|
116 |
|
117 |
/**
|
118 |
* Get meta facebook title
|
|
|
119 |
* @param string $meta_title_esc meta title default
|
120 |
+
* @param int $id id of post
|
121 |
* @return mixed|string
|
122 |
*/
|
123 |
+
public function getFbtitle($meta_title_esc, $id)
|
124 |
{
|
125 |
+
$meta_fbtitle = get_post_meta($id, '_metaseo_metaopengraph-title', true);
|
126 |
if ($meta_fbtitle != maybe_unserialize($meta_fbtitle)) {
|
127 |
$meta_fbtitle = '';
|
128 |
}
|
136 |
|
137 |
/**
|
138 |
* Get meta facebook description
|
|
|
139 |
* @param string $meta_desc_esc meta description default
|
140 |
+
* @param int $id id of post
|
141 |
* @return mixed|string
|
142 |
*/
|
143 |
+
public function getFbdesc($meta_desc_esc, $id)
|
144 |
{
|
145 |
+
$meta_fbdesc = get_post_meta($id, '_metaseo_metaopengraph-desc', true);
|
146 |
if ($meta_fbdesc != maybe_unserialize($meta_fbdesc)) {
|
147 |
$meta_fbdesc = '';
|
148 |
}
|
156 |
|
157 |
/**
|
158 |
* Get meta facebook image and twiter image
|
159 |
+
* @param int $id id of post
|
160 |
* @return array
|
161 |
*/
|
162 |
+
public function getImage($id)
|
163 |
{
|
164 |
+
$meta_twimage = get_post_meta($id, '_metaseo_metatwitter-image', true);
|
165 |
+
$meta_fbimage = get_post_meta($id, '_metaseo_metaopengraph-image', true);
|
166 |
|
167 |
+
$default_image = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'single-post-thumbnail');
|
168 |
if (empty($meta_twimage) && isset($default_image[0])) {
|
169 |
$meta_twimage = $default_image[0];
|
170 |
}
|
178 |
|
179 |
/**
|
180 |
* Get meta twiter title
|
|
|
181 |
* @param string $meta_title_esc meta title default
|
182 |
+
* @param int $id id of post
|
183 |
* @return string
|
184 |
*/
|
185 |
+
public function getTwtitle($meta_title_esc, $id)
|
186 |
{
|
187 |
+
$twitter_title = get_post_meta($id, '_metaseo_metatwitter-title', true);
|
188 |
if ($twitter_title != maybe_unserialize($twitter_title)) {
|
189 |
$twitter_title = '';
|
190 |
}
|
199 |
|
200 |
/**
|
201 |
* Get meta twiter description
|
|
|
202 |
* @param string $meta_desc_esc meta description default
|
203 |
+
* @param int $id id of post
|
204 |
* @return string
|
205 |
*/
|
206 |
+
public function getTwdesc($meta_desc_esc, $id)
|
207 |
{
|
208 |
+
$twitter_desc = get_post_meta($id, '_metaseo_metatwitter-desc', true);
|
209 |
if ($twitter_desc != maybe_unserialize($twitter_desc)) {
|
210 |
$twitter_desc = '';
|
211 |
}
|
355 |
|
356 |
/**
|
357 |
* Get meta facebook admin and twitter site
|
|
|
358 |
* @param array $settings meta seo settings
|
359 |
+
* @param int $id id of post
|
360 |
* @return array
|
361 |
*/
|
362 |
+
public function getUserMeta($settings, $id)
|
363 |
{
|
364 |
+
$post = get_post($id);
|
365 |
+
$meta_twitter_site = get_user_meta($post->post_author, 'mtwitter', true);
|
366 |
+
$facebook_admin = get_user_meta($post->post_author, 'mfacebook', true);
|
367 |
|
368 |
if ($settings) {
|
369 |
if ($meta_twitter_site == '' && $settings['metaseo_showtwitter'] != '') {
|
414 |
}
|
415 |
|
416 |
/**
|
417 |
+
* @param int $id id of post
|
418 |
* @param array $settings meta seo settings
|
419 |
* @param string $meta_twimage meta twiter image
|
420 |
* @param string $meta_twcard meta twiter card
|
422 |
* @param string $sitename site name
|
423 |
* @param string $meta_twdesc meta twiter description
|
424 |
* @param string $meta_twtitle meta twiter title
|
|
|
425 |
* @param string $facebook_admin meta facebook admin
|
426 |
* @param string $meta_fbimage meta facebook image
|
427 |
* @param string $meta_fbdesc meta facebook description
|
437 |
* @return array
|
438 |
*/
|
439 |
public function getPatterns(
|
440 |
+
$id,
|
441 |
$settings,
|
442 |
$meta_twimage,
|
443 |
$meta_twcard,
|
445 |
$sitename,
|
446 |
$meta_twdesc,
|
447 |
$meta_twtitle,
|
|
|
448 |
$facebook_admin,
|
449 |
$meta_fbimage,
|
450 |
$meta_fbdesc,
|
483 |
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
484 |
'<meta name="twitter:title" content="' . $meta_twtitle . '" />',
|
485 |
($meta_twtitle != '' ? true : false)),
|
|
|
|
|
486 |
'facebook_admin' => array(
|
487 |
'#<meta property="fb:admins" [^<>]+ ?>#i',
|
488 |
'<meta property="fb:admins" content="' . $facebook_admin . '" />',
|
536 |
);
|
537 |
}
|
538 |
|
539 |
+
if (get_post_meta($id, '_metaseo_metatitle', true) != '') {
|
540 |
$patterns['title'] = array(
|
541 |
'#<meta name="title" [^<>]+ ?>#i',
|
542 |
'<meta name="title" content="' . $meta_title_esc . '" />',
|
610 |
unset($patterns['site_name']);
|
611 |
unset($patterns['og:description']);
|
612 |
unset($patterns['og:title']);
|
613 |
+
unset($patterns['og:type']);
|
614 |
+
unset($patterns['og:url']);
|
615 |
}
|
616 |
|
617 |
return $patterns;
|
languages/wp-meta-seo-en_US.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: JoomUnited
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.9.
|
6 |
-
Stable tag: 3.6.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -272,6 +272,11 @@ It could be! if you have a lot of pages that need to be indexed with no specific
|
|
272 |
|
273 |
== Changelog ==
|
274 |
|
|
|
|
|
|
|
|
|
|
|
275 |
= 3.6.3 =
|
276 |
* Add : Change meta description max length (320 characters)
|
277 |
* Fix : Conflict with Antispam Bee plugin
|
2 |
Contributors: JoomUnited
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.9.4
|
6 |
+
Stable tag: 3.6.4
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
272 |
|
273 |
== Changelog ==
|
274 |
|
275 |
+
= 3.6.4 =
|
276 |
+
* Fix : Google analytics tracking code removed some characters
|
277 |
+
* Fix : Send email (SEO report)
|
278 |
+
* Fix : Query duplicate meta
|
279 |
+
|
280 |
= 3.6.3 =
|
281 |
* Add : Change meta description max length (320 characters)
|
282 |
* Fix : Conflict with Antispam Bee plugin
|
wp-meta-seo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
-
* Version: 3.6.
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
@@ -99,7 +99,7 @@ if (!defined('WPMSEO_VERSION')) {
|
|
99 |
/**
|
100 |
* plugin version
|
101 |
*/
|
102 |
-
define('WPMSEO_VERSION', '3.6.
|
103 |
}
|
104 |
|
105 |
if (!defined('WPMS_CLIENTID')) {
|
@@ -239,73 +239,59 @@ if (is_admin()) {
|
|
239 |
|
240 |
/******** Check again and modify title, meta title, meta description before output ********/
|
241 |
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-opengraph.php');
|
242 |
-
add_action('plugins_loaded', 'wpmsFrontendInit', 15);
|
243 |
-
function wpmsFrontendInit()
|
244 |
-
{
|
245 |
-
if (is_plugin_active('divi_layout_injector/divi_layout_injector.php')) {
|
246 |
-
add_action('get_header', 'bufferStart');
|
247 |
-
} else {
|
248 |
-
add_action('template_redirect', 'bufferStart', 999);
|
249 |
-
}
|
250 |
-
}
|
251 |
-
|
252 |
-
add_action('wp_head', 'bufferEnd');
|
253 |
-
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-front_end.php');
|
254 |
-
$GLOBALS['metaseo_front'] = new MetaSeoFront;
|
255 |
-
function bufferStart()
|
256 |
-
{
|
257 |
-
ob_start("wpmsCallback");
|
258 |
-
}
|
259 |
|
260 |
-
|
261 |
-
|
262 |
-
ob_end_flush();
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* @param $buffer
|
267 |
-
* @return mixed
|
268 |
-
*/
|
269 |
-
function wpmsCallback($buffer)
|
270 |
{
|
271 |
-
// modify buffer here, and then return the updated code
|
272 |
global $wp_query;
|
273 |
-
$
|
274 |
-
if (
|
275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
}
|
277 |
-
|
|
|
278 |
// get meta title
|
279 |
$opengraph = new MetaSeoOpenGraph();
|
280 |
-
$meta_title = $opengraph->getTitle($
|
281 |
-
$meta_title_esc = $opengraph->getMetaTitle($
|
282 |
// get meta description
|
283 |
-
$meta_desc_esc = $opengraph->getDesc($
|
284 |
// get meta keyword
|
285 |
-
$meta_keywords_esc = $opengraph->getKeyword($
|
286 |
-
$page_follow = get_post_meta($
|
287 |
-
$page_index = get_post_meta($
|
288 |
// get meta title for twitter
|
289 |
-
$meta_twtitle = $opengraph->getTwtitle($
|
290 |
// get meta description for twitter
|
291 |
-
$meta_twdesc = $opengraph->getTwdesc($
|
292 |
// get twiter card
|
293 |
$meta_twcard = $opengraph->getTwCard($settings);
|
294 |
|
295 |
// get facebook admin and twiter site meta
|
296 |
-
$usermeta = $opengraph->getUserMeta($
|
297 |
$meta_twitter_site = $usermeta['meta_twitter_site'];
|
298 |
$facebook_admin = $usermeta['facebook_admin'];
|
299 |
$sitename = get_bloginfo('name');
|
300 |
|
301 |
// get meta title for facebook
|
302 |
-
$meta_fbtitle = $opengraph->getFbtitle($
|
303 |
// get meta description for facebook
|
304 |
-
$meta_fbdesc = $opengraph->getFbdesc($
|
305 |
// get facebook app id
|
306 |
$fbapp_id = $settings['metaseo_showfbappid'];
|
307 |
// get meta image for facebook & twiter
|
308 |
-
$images = $opengraph->getImage($
|
309 |
$meta_fbimage = $images[0];
|
310 |
$meta_twimage = $images[1];
|
311 |
|
@@ -315,7 +301,7 @@ if (is_admin()) {
|
|
315 |
// check homepage is latest post
|
316 |
if (is_home()) {
|
317 |
$metas = $opengraph->getHome($settings);
|
318 |
-
$
|
319 |
if (isset($metas['desc'])) {
|
320 |
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $metas['desc'];
|
321 |
}
|
@@ -326,7 +312,7 @@ if (is_admin()) {
|
|
326 |
// is front page
|
327 |
if (is_front_page() && 'page' == get_option('show_on_front') && is_page(get_option('page_on_front'))) {
|
328 |
$metas = $opengraph->getFrontPageMeta();
|
329 |
-
$
|
330 |
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $metas['desc'];
|
331 |
$page_follow = $metas['page_follow'];
|
332 |
$page_index = $metas['page_index'];
|
@@ -336,7 +322,7 @@ if (is_admin()) {
|
|
336 |
if (is_category() || is_tag() || is_tax()) {
|
337 |
$metas = $opengraph->getTagMeta($wp_query, $settings);
|
338 |
$meta_keywords_esc = $metas['keyword'];
|
339 |
-
$
|
340 |
$meta_desc_esc = $meta_fbdesc = $meta_twdesc = $metas['desc'];
|
341 |
$page_follow = 'follow';
|
342 |
}
|
@@ -349,9 +335,8 @@ if (is_admin()) {
|
|
349 |
$page_follow = 'follow';
|
350 |
}
|
351 |
|
352 |
-
// create List array meta tag
|
353 |
$patterns = $opengraph->getPatterns(
|
354 |
-
$
|
355 |
$settings,
|
356 |
$meta_twimage,
|
357 |
$meta_twcard,
|
@@ -359,7 +344,6 @@ if (is_admin()) {
|
|
359 |
$sitename,
|
360 |
$meta_twdesc,
|
361 |
$meta_twtitle,
|
362 |
-
$meta_title,
|
363 |
$facebook_admin,
|
364 |
$meta_fbimage,
|
365 |
$meta_fbdesc,
|
@@ -375,26 +359,75 @@ if (is_admin()) {
|
|
375 |
);
|
376 |
|
377 |
foreach ($patterns as $k => $pattern) {
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
}
|
387 |
-
}
|
388 |
|
389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
} else {
|
391 |
-
$
|
392 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
}
|
394 |
|
395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
}
|
397 |
|
|
|
|
|
|
|
398 |
/* * ******************************************** */
|
399 |
}
|
400 |
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
+
* Version: 3.6.4
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
99 |
/**
|
100 |
* plugin version
|
101 |
*/
|
102 |
+
define('WPMSEO_VERSION', '3.6.4');
|
103 |
}
|
104 |
|
105 |
if (!defined('WPMS_CLIENTID')) {
|
239 |
|
240 |
/******** Check again and modify title, meta title, meta description before output ********/
|
241 |
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-opengraph.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
|
243 |
+
add_action( 'wpmsseo_head', 'wpmsopengraph', 30 );
|
244 |
+
function wpmsopengraph()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
{
|
|
|
246 |
global $wp_query;
|
247 |
+
$is_shop = false;
|
248 |
+
if ( function_exists( 'is_shop' ) ) {
|
249 |
+
if (is_shop()) {
|
250 |
+
$is_shop = true;
|
251 |
+
$id = wc_get_page_id( 'shop' );
|
252 |
+
$post = get_post($id);
|
253 |
+
$content = $post->post_content;
|
254 |
+
} else {
|
255 |
+
$id = $wp_query->post->ID;
|
256 |
+
$content = $wp_query->post->post_content;
|
257 |
+
}
|
258 |
+
} else {
|
259 |
+
$id = $wp_query->post->ID;
|
260 |
+
$content = $wp_query->post->post_content;
|
261 |
}
|
262 |
+
wp_reset_query();
|
263 |
+
$settings = get_option('_metaseo_settings');
|
264 |
// get meta title
|
265 |
$opengraph = new MetaSeoOpenGraph();
|
266 |
+
$meta_title = $opengraph->getTitle($is_shop, $id);
|
267 |
+
$meta_title_esc = $opengraph->getMetaTitle($settings, $meta_title);
|
268 |
// get meta description
|
269 |
+
$meta_desc_esc = $opengraph->getDesc($settings, $id, $content);
|
270 |
// get meta keyword
|
271 |
+
$meta_keywords_esc = $opengraph->getKeyword($settings, $id);
|
272 |
+
$page_follow = get_post_meta($id, '_metaseo_metafollow', true);
|
273 |
+
$page_index = get_post_meta($id, '_metaseo_metaindex', true);
|
274 |
// get meta title for twitter
|
275 |
+
$meta_twtitle = $opengraph->getTwtitle($meta_title_esc, $id);
|
276 |
// get meta description for twitter
|
277 |
+
$meta_twdesc = $opengraph->getTwdesc($meta_desc_esc, $id);
|
278 |
// get twiter card
|
279 |
$meta_twcard = $opengraph->getTwCard($settings);
|
280 |
|
281 |
// get facebook admin and twiter site meta
|
282 |
+
$usermeta = $opengraph->getUserMeta($settings, $id);
|
283 |
$meta_twitter_site = $usermeta['meta_twitter_site'];
|
284 |
$facebook_admin = $usermeta['facebook_admin'];
|
285 |
$sitename = get_bloginfo('name');
|
286 |
|
287 |
// get meta title for facebook
|
288 |
+
$meta_fbtitle = $opengraph->getFbtitle($meta_title_esc, $id);
|
289 |
// get meta description for facebook
|
290 |
+
$meta_fbdesc = $opengraph->getFbdesc($meta_desc_esc, $id);
|
291 |
// get facebook app id
|
292 |
$fbapp_id = $settings['metaseo_showfbappid'];
|
293 |
// get meta image for facebook & twiter
|
294 |
+
$images = $opengraph->getImage($id);
|
295 |
$meta_fbimage = $images[0];
|
296 |
$meta_twimage = $images[1];
|
297 |
|
301 |
// check homepage is latest post
|
302 |
if (is_home()) {
|
303 |
$metas = $opengraph->getHome($settings);
|
304 |
+
$meta_title_esc = $meta_twtitle = $meta_fbtitle = $metas['title'];
|
305 |
if (isset($metas['desc'])) {
|
306 |
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $metas['desc'];
|
307 |
}
|
312 |
// is front page
|
313 |
if (is_front_page() && 'page' == get_option('show_on_front') && is_page(get_option('page_on_front'))) {
|
314 |
$metas = $opengraph->getFrontPageMeta();
|
315 |
+
$meta_title_esc = $meta_twtitle = $meta_fbtitle = $metas['title'];
|
316 |
$meta_desc_esc = $meta_twdesc = $meta_fbdesc = $metas['desc'];
|
317 |
$page_follow = $metas['page_follow'];
|
318 |
$page_index = $metas['page_index'];
|
322 |
if (is_category() || is_tag() || is_tax()) {
|
323 |
$metas = $opengraph->getTagMeta($wp_query, $settings);
|
324 |
$meta_keywords_esc = $metas['keyword'];
|
325 |
+
$meta_title_esc = $meta_fbtitle = $meta_twtitle = $metas['title'];
|
326 |
$meta_desc_esc = $meta_fbdesc = $meta_twdesc = $metas['desc'];
|
327 |
$page_follow = 'follow';
|
328 |
}
|
335 |
$page_follow = 'follow';
|
336 |
}
|
337 |
|
|
|
338 |
$patterns = $opengraph->getPatterns(
|
339 |
+
$id,
|
340 |
$settings,
|
341 |
$meta_twimage,
|
342 |
$meta_twcard,
|
344 |
$sitename,
|
345 |
$meta_twdesc,
|
346 |
$meta_twtitle,
|
|
|
347 |
$facebook_admin,
|
348 |
$meta_fbimage,
|
349 |
$meta_fbdesc,
|
359 |
);
|
360 |
|
361 |
foreach ($patterns as $k => $pattern) {
|
362 |
+
echo $pattern[1];
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
+
add_action('wp_head', 'wpmshead', 1);
|
367 |
+
function wpmshead()
|
368 |
+
{
|
369 |
+
global $wp_query;
|
|
|
|
|
370 |
|
371 |
+
$old_wp_query = null;
|
372 |
+
|
373 |
+
if ( ! $wp_query->is_main_query() ) {
|
374 |
+
$old_wp_query = $wp_query;
|
375 |
+
wp_reset_query();
|
376 |
+
}
|
377 |
+
|
378 |
+
do_action( 'wpmsseo_head' );
|
379 |
+
|
380 |
+
if ( ! empty( $old_wp_query ) ) {
|
381 |
+
$GLOBALS['wp_query'] = $old_wp_query;
|
382 |
+
unset( $old_wp_query );
|
383 |
+
}
|
384 |
+
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
|
388 |
+
add_filter( 'pre_get_document_title', 'wpmstitle', 15 );
|
389 |
+
function wpmstitle($title) {
|
390 |
+
global $wp_query;
|
391 |
+
$is_shop = false;
|
392 |
+
if ( function_exists( 'is_shop' ) ) {
|
393 |
+
if (is_shop()) {
|
394 |
+
$is_shop = true;
|
395 |
+
$id = wc_get_page_id( 'shop' );
|
396 |
} else {
|
397 |
+
$id = $wp_query->post->ID;
|
398 |
}
|
399 |
+
} else {
|
400 |
+
$id = $wp_query->post->ID;
|
401 |
+
}
|
402 |
+
$settings = get_option('_metaseo_settings');
|
403 |
+
$opengraph = new MetaSeoOpenGraph();
|
404 |
+
$meta_title = $opengraph->getTitle($is_shop, $id);
|
405 |
+
|
406 |
+
if (is_home()) {
|
407 |
+
$metas = $opengraph->getHome($settings);
|
408 |
+
$meta_title = $metas['title'];
|
409 |
+
}
|
410 |
+
|
411 |
+
// is front page
|
412 |
+
if (is_front_page() && 'page' == get_option('show_on_front') && is_page(get_option('page_on_front'))) {
|
413 |
+
$metas = $opengraph->getFrontPageMeta();
|
414 |
+
$meta_title = $metas['title'];
|
415 |
}
|
416 |
|
417 |
+
$term = $wp_query->get_queried_object();
|
418 |
+
if (is_category() || is_tag() || is_tax()) {
|
419 |
+
if (function_exists('get_term_meta')) {
|
420 |
+
$meta_title = get_term_meta($term->term_id, 'wpms_category_metatitle', true);
|
421 |
+
} else {
|
422 |
+
$meta_title = get_metadata('term', $term->term_id, 'wpms_category_metatitle', true);
|
423 |
+
}
|
424 |
+
}
|
425 |
+
return $meta_title;
|
426 |
}
|
427 |
|
428 |
+
require_once(WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-front_end.php');
|
429 |
+
$GLOBALS['metaseo_front'] = new MetaSeoFront;
|
430 |
+
|
431 |
/* * ******************************************** */
|
432 |
}
|
433 |
|