Created
January 25, 2021 15:15
-
-
Save yousufansa/08684ce49be231e083f2f2f320dbd13d to your computer and use it in GitHub Desktop.
Jobhunt - Make all the filter widgets closed on refresh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( ! function_exists( 'jh_child_make_sidebar_filters_collapse_close' ) ) { | |
function jh_child_make_sidebar_filters_collapse_close() { | |
ob_start(); ?> | |
(function ($) { | |
"use strict"; | |
$(document).ready(function () { | |
$( '.widget_jobhunt_wpjm_layered_nav .widget-title, .widget_jobhunt_wpjmr_layered_nav .widget-title, .widget_jobhunt_wpjmc_layered_nav .widget-title, .widget_jobhunt_wpjm_date_filter .widget-title, .widget_jobhunt_wpjmr_date_filter .widget-title, .widget_jobhunt_wpjmc_date_filter .widget-title' ).each( function( index ) { | |
if( index <= 2 ) { | |
$( this ).parent().addClass( 'closed' ); | |
} | |
}); | |
}); | |
})(jQuery); | |
<?php | |
$custom_script = ob_get_clean(); | |
wp_add_inline_script( 'jobhunt-scripts', $custom_script ); | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'jh_child_make_sidebar_filters_collapse_close', 30 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment