• I have trouble with deregistring the css files for tablepress-responsive-tables and tablepress-responsive-tables-flip.

    I found in the plugin.php the lines:

    public static function enqueue_css_files() {
    		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
    		$url = plugins_url( "css/responsive.dataTables{$suffix}.css", __FILE__ );
    		wp_enqueue_style( self::$slug, $url, array(), self::$version );
    	}
    
    	public static function enqueue_css_files_flip() {
    		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
    		$url = plugins_url( "css/tablepress-responsive-flip{$suffix}.css", __FILE__ );
    		wp_enqueue_style( self::$slug . '-flip', $url, array( 'tablepress-default' ), self::$version );
    		// Wrap the <link> tag in a conditional comment to only use the CSS in non-IE browsers.
    		echo "<!--[if !IE]><!-->\n";
    		wp_print_styles( self::$slug . '-flip' );
    		echo "<!--<![endif]-->\n";
    	}

    and

    protected static $slug = 'tablepress-responsive-tables';

    So I guess the right handle is “tablepress-responsive-tables” or “tablepress-responsive-tables-flip” but It doesn’t work.

    Tried this code variations:

    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
    
    function my_deregister_styles() {
    	wp_dequeue_style('tablepress-responsive-tables');
    	wp_deregister_style( 'tablepress-responsive-tables' );
    	wp_dequeue_style('tablepress-responsive-tables-flip');
    	wp_deregister_style( 'tablepress-responsive-tables-flip' );
    
    }

    But nothing works. CSS-File is still there. Can someone help me?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi,

    thanks for your post, and sorry for the trouble.

    Doing this in the wp_print_stylesat priority 100 is probably too late. Can you try the wp_print_scripts with a priority of 9?

    Regards,
    Tobias

    Thread Starter sturmghost

    (@sturmghost)

    Thanks for your answer.

    Changing the priority to 9 doesn’t work. File is still included.

    Hi,

    even with the different hook?

    The alternative could be to unhook the functions that enqueue the styles, i.e. to unhook enqueue_css_files() and enqueue_css_files_flip() from their registered actions, using remove_action().

    Regards,
    Tobias

    Thread Starter sturmghost

    (@sturmghost)

    I used this code:

    add_action( 'init', 'remove_my_action' );
    	function remove_my_action(){
    	remove_action( 'enqueue_css_files', 'function_being_removed' );
    	remove_action( 'enqueue_css_files_flip', 'function_being_removed' );
    }

    But css is still present. Maybe I’m doing it wrong?

    Hi,

    that’s not the correct code. I mean something like

    add_action( 'tablepress_run', 'sturmghost_remove_tablepress_css', 11 );
    function sturmghost_remove_tablepress_css() {
    	remove_action( 'wp_enqueue_scripts', array( 'TablePress_Responsive_Tables', 'enqueue_css_files' ) );
    	remove_action( 'wp_print_scripts', array( 'TablePress_Responsive_Tables', 'enqueue_css_files_flip' ) );
    }

    Regards,
    Tobias

    Thread Starter sturmghost

    (@sturmghost)

    Nice one. Your code worked for me. Thank you!

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: TablePress Responsive Tables] TablePress Responsive Deregister CSS’ is closed to new replies.