Support » Plugin: WP Editor » Conflict with My Custom CSS

  • Resolved Salvatore

    (@darkwolf)


    I need to resolve an issue with My Custom CSS plugin!
    Both plugin use same CodeMIrror class and this cause conflict with css (your plugin insert meta css in every page).

    I’ve try to disable in My Custom CSS page with this:

    <?php
    // Disable "WP Editor" in this page if is active: http://wordpress.org/extend/plugins/wp-editor/
    function remove_wp_editor_header() {
    	If (is_plugin_active("wp-editor/wpeditor.php")) {
    	remove_action('wp_head', 'WPEditor');
    	}
    }
    add_action('wp_head', 'remove_wp_editor_header', 1);
    ?>

    But don’t work…

    I need to remove:

    <link rel='stylesheet' id='wpeditor-css'  href='http://***/wp-content/plugins/wp-editor/wpeditor.css?ver=1.2' type='text/css' media='all' />
    <link rel='stylesheet' id='fancybox-css'  href='http://***/wp-content/plugins/wp-editor/extensions/fancybox/jquery.fancybox-1.3.4.css?ver=1.2' type='text/css' media='all' />
    <link rel='stylesheet' id='codemirror-css'  href='http://***/wp-content/plugins/wp-editor/extensions/codemirror/codemirror.css?ver=1.2' type='text/css' media='all' />
    <link rel='stylesheet' id='codemirror_dialog-css'  href='http://***/wp-content/plugins/wp-editor/extensions/codemirror/dialog.css?ver=1.2' type='text/css' media='all' />
    <link rel='stylesheet' id='codemirror_themes-css'  href='http://***/wp-content/plugins/wp-editor/extensions/codemirror/themes/themes.css?ver=1.2' type='text/css' media='all' />

    And:

    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/js/wpeditor.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/fancybox/js/jquery.fancybox-1.3.4.pack.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/codemirror.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/mustache.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/php.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/javascript.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/css.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/xml.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/clike.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/dialog.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/search.js?ver=1.2'></script>
    <script type='text/javascript' src='http://***/wp-content/plugins/wp-editor/extensions/codemirror/js/searchcursor.js?ver=1.2'></script>


    Thank in advance…
    DarkWolf 🙂

    http://wordpress.org/extend/plugins/wp-editor/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author benjaminprojas

    (@benjaminprojas)

    DarkWolf,

    I am aware of the conflict between WP Editor and My Custom CSS. I am hoping to have a fix for this in the next release of WP Editor, but am not sure when that will be.

    My idea is to make this filter inside my plugin to disable wpeditor css and script from My Custom CSS page, but i don’t know wpeditor class name: ***

    <?php
    // Disable "WP Editor" in this page if is active: http://wordpress.org/extend/plugins/wp-editor/
    If (is_plugin_active("wp-editor/wpeditor.php")) {
    	function Remove_WPEditor() {
    	wp_dequeue_style('***');
    	wp_deregister_script('***');
    	}
    }
    add_action('wp_enqueue_scripts', 'Remove_WPEditor');
    ?>

    :/

    I’ve try with: “wpeditor; WPEditor and WPEditorAdmin” but without success 🙁

    Edit: i’ve seen best in souurce and thanks of this i’ve make this code:

    <?php
    // Disable "WP Editor" in this page if is active: http://wordpress.org/extend/plugins/wp-editor/
    If (is_plugin_active("wp-editor/wpeditor.php")) {
    	function Remove_WPEditor_style() {
    	wp_deregister_style('wpeditor');
    	wp_deregister_style('fancybox');
    	wp_deregister_style('codemirror');
    	wp_deregister_style('codemirror_dialog');
    	wp_deregister_style('codemirror_themes');
    	}
    	function Remove_WPEditor_script() {
    	wp_deregister_script('wpeditor');
    	wp_deregister_script('wp-editor-posts-jquery');
    	wp_deregister_script('codemirror');
    	wp_deregister_script('codemirror_php');
    	wp_deregister_script('codemirror_javascript');
    	wp_deregister_script('codemirror_css');
    	wp_deregister_script('codemirror_xml');
    	wp_deregister_script('codemirror_clike');
    	wp_deregister_script('codemirror_dialog');
    	wp_deregister_script('codemirror_search');
    	wp_deregister_script('codemirror_searchcursor');
    	wp_deregister_script('codemirror_mustache');
    	}
    add_action('wp_deregister_style', 'Remove_WPEditor_style');
    add_action('wp_deregister_scripts', 'Remove_WPEditor_script');
    }
    ?>

    But still continue to don’t work…

    Ok, i’ve fix with this in my plugin (remove your meta from my plugin page):

    function mccss_admin() {
    
    	$icon_url = WP_PLUGIN_URL."/".str_replace(basename( __FILE__),"",plugin_basename(__FILE__))."css-icon.png";
    	$plugin_page = add_menu_page(__('My Custom CSS Panel','mccss'),__('My Custom CSS','mccss'), 'manage_options', 'my_custom_css', 'mccss_options', $icon_url, 61);
    	add_action( 'admin_init', 'register_settings_mccss' );
    	add_action( 'admin_head-'. $plugin_page, 'mccss_syntax' );
    
    	// Disable "WP Editor" in this page if is active: http://wordpress.org/extend/plugins/wp-editor/
    	If ( is_plugin_active("wp-editor/wpeditor.php") && $_SERVER['QUERY_STRING'] == 'page=my_custom_css') {
    		function remove_wpeditor_header_info(){
    		wp_deregister_style('wpeditor');
    		wp_deregister_style('fancybox');
    		wp_deregister_style('codemirror');
    		wp_deregister_style('codemirror_dialog');
    		wp_deregister_style('codemirror_themes');
    		wp_deregister_script('wpeditor');
    		wp_deregister_script('wp-editor-posts-jquery');
    		wp_deregister_script('codemirror');
    		wp_deregister_script('codemirror_php');
    		wp_deregister_script('codemirror_javascript');
    		wp_deregister_script('codemirror_css');
    		wp_deregister_script('codemirror_xml');
    		wp_deregister_script('codemirror_clike');
    		wp_deregister_script('codemirror_dialog');
    		wp_deregister_script('codemirror_search');
    		wp_deregister_script('codemirror_searchcursor');
    		wp_deregister_script('codemirror_mustache');
    		}
    		add_action('admin_init', 'remove_wpeditor_header_info', 20);
    	}
    
    }

    But, IMHO, is best to make a filter to add your code only when is really utilized! ATM you put in entire backend… 😐

    Plugin Author benjaminprojas

    (@benjaminprojas)

    DarkWolf,

    The next update of WP Editor will only call the scripts when needed, and not on every page. Once it is released you can remove your code and all should be well!

    OK, thanks… i remove in next update 😉

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conflict with My Custom CSS’ is closed to new replies.