• Resolved grahambudd

    (@grahambudd)


    In the live-search-results.php file there are these notes:

     * Some base styles are output in wp_footer that do nothing but position the
     * results container and apply a default transition, you can disable that by
     * adding the following to your theme's functions.php:
     *
     * add_filter( 'searchwp_live_search_base_styles', '__return_false' );
     *
     * There is a separate stylesheet that is also enqueued that applies the default
     * results theme (the visual styles) but you can disable that too by adding
     * the following to your theme's functions.php:
     *
     * wp_dequeue_style( 'searchwp-live-search' );

    However adding these two items in the theme’s functions.php file does not appear to have any impact on the styles that are loaded. Changing the backend CMS settings for Results -> Include Styling does appear to correctly limit those styles from being included. Is there a correct way to implement those functions in code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter grahambudd

    (@grahambudd)

    It appears that a priority greater than 20 is needed to dequeue the styles. So this works:

    function custom_search_dequeue_scripts() {
    	wp_dequeue_style( 'searchwp-live-search' );
    }
    add_action( 'wp_enqueue_scripts', 'custom_search_dequeue_scripts', 21 );
    Plugin Author Elio Bruno

    (@ambrelio)

    Hi @grahambudd,

    The code sample should work as expected.

    If you add this hook, the dropdown will not be positioned under the search bar:

    add_filter( 'searchwp_live_search_base_styles', '__return_false' );

    To dequeue the visual styles instead, you can use this code

    add_action( 'wp_enqueue_scripts', function () {
    	wp_dequeue_style( 'searchwp-live-search' );
    }, 30 );
    Plugin Author Elio Bruno

    (@ambrelio)

    Hi @grahambudd,

    I am closing this ticket as resolved as there were no more responses.

    But if you still have issues, please feel free to reopen it!

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dequeue styles via code doesn’t work’ is closed to new replies.