-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.php
executable file
·62 lines (51 loc) · 1.98 KB
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
Plugin Name: WPDevDesign Oxygen Yoast SEO
Plugin URI: https://wpdevdesign.com/fix-for-yoast-seo-in-oxygen/
Description: Includes WordPress content in Yoast's SEO analsysis when using Oxygen.
Version: 1.0.0
Author: Sridhar Katakam
Author URI: https://wpdevdesign.com
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
This plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with This plugin. If not, see {URI to Plugin License}.
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
remove_action( 'admin_enqueue_scripts', 'oxygen_vsb_yoast_compatibility', 11 );
add_action( 'admin_enqueue_scripts', 'wpdd_oxygen_yoast_compatibility', 11 );
/**
* Loads <list assets here>.
*/
function wpdd_oxygen_yoast_compatibility() {
// check if Yoast Seo is active
if ( ! is_plugin_active( 'wordpress-seo/wp-seo.php' ) && ! is_plugin_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) {
return;
}
global $pagenow;
global $post;
// save global $post to restore later
$saved_post = $post;
// exclude templates
if ( is_object( $post ) && $post->post_type=='ct_template' ) {
return;
}
if ( 'post.php' == $pagenow && ! is_null( $post ) ) {
wp_enqueue_script( 'ysco-oxygen-analysis', plugin_dir_url( __FILE__ ) . '/assets/js/yoast-seo-compatibility.js', array( 'jquery' ), false, true );
wp_localize_script( 'ysco-oxygen-analysis', 'ysco_data', array(
'oxygen_markup' => ct_do_shortcode( get_post_meta( $post->ID, 'ct_builder_shortcodes', true ) )
) );
}
// restore original global post
$post = $saved_post;
}