WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Howto deregister Jetpack styles (5 posts)

  1. glen_f
    Member
    Posted 1 year ago #

    Hi

    I've been searching the forum a lot but I've not seen a working solution to deregistering styles. I need to remove stylesheet so overwriting is not a solution.

    THe stylesheet I currently want to remove is tiled-gallery.css. I've tried to include
    wp_deregister_style('tiled-gallery');
    and
    wp_deregister_style('tiled-gallery.css');
    to my functions following this kind of instructions http://www.tjkelly.com/remove-wordpress-jetpack-css/ with no luck.

    I have managed to deregister other styles (contact-form-7) succesfully on the same function so the function does work.

    WP is the latest (3.5.1)
    Jetpack is 2.2
    Base theme is Bones

    http://wordpress.org/extend/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    The Tiled Gallery CSS file is added later, so the tutorial you mentioned in your post won't work.

    Try the following code instead:

    function tweakjp_rm_tiledcss(){
    	wp_dequeue_style( 'tiled-gallery' );
    }
    add_action( 'post_gallery', 'tweakjp_rm_tiledcss', 1002 );
  3. glen_f
    Member
    Posted 1 year ago #

    It kinda works. But then again it loses the functionality. I don't want to lose the functionality of the gallery.

    I've got the styles added to my site wide stylesheet already and I'm trying to loose the extra requests.

    So the solution is close but not working. I'm still struggling with WordPress's way of handling these plugin styles and scripts.

    So thank you for your help.

  4. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Try to hook into wp_footer instead, that should do the trick:

    function tweakjp_rm_tiledcss(){
    	wp_dequeue_style( 'tiled-gallery' );
    }
    add_action( 'wp_footer', 'tweakjp_rm_tiledcss' );
  5. glen_f
    Member
    Posted 1 year ago #

    Thank you very much. This day isn't that bad because I've learned something new today.

    It works. Still a long way to learn with the wp hooks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic