• Resolved lesurfeur

    (@lesurfeur)


    Hello,
    I would like to be able to remove the css in the code.

    ex:

    <h3>Films similaires</h3>
    <style type=”text/css”>
    #gallery-1 {
    margin: auto;
    }
    #gallery-1 .gallery-item {
    float: left;
    margin-top: 10px;
    text-align: center;
    width: 16%;

    </style>
    <div id=”gallery-1″ class=”gallery related-gallery related-galleryid-2732 gallery-columns-6 gallery-size-thumbnail”>

    https://wordpress.org/plugins/related-posts-by-taxonomy/

Viewing 1 replies (of 1 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi lesurfeur

    Try it with the use_default_gallery_style filter hook in your theme’s functions.php file. This will remove the styles from all the WordPress galleries, and the post thumbnail galleries displayed by this plugin.

    add_filter( 'use_default_gallery_style', '__return_false' );

    Try it with this in your theme’s functions.php if you want to remove the styles from this plugin’s galleries only:

    // filter run before styles are printed for a related posts gallery
    add_filter( 'related_posts_by_taxonomy_gallery', 'related_gallery_return_false' );
    
    function related_gallery_return_false( $args ) {
    
    	// don't print styles for related posts by taxonomy gallery
    	add_filter( 'use_default_gallery_style', '__return_false' );
    
    	// reset gallery style for other galleries
    	add_filter( 'gallery_style', 'related_gallery_reset_filter' );
    
    	return $args;
    }
    
    function related_gallery_reset_filter( $style ) {
    
    	// use default styles for galleries
    	add_filter( 'use_default_gallery_style', '__return_true' );
    
    	return $style;
    }

    btw:
    consider creating a child theme instead of editing your theme directly – if you upgrade the theme all your modifications will be lost. Or create a plugin with the code above.

Viewing 1 replies (of 1 total)
  • The topic ‘Remove CSS in code’ is closed to new replies.