Skip to content

Instantly share code, notes, and snippets.

@bryanrsebastian
Created January 15, 2021 03:41
Show Gist options
  • Save bryanrsebastian/df871eb0559fb4a25d47f3cf0fc4a6d6 to your computer and use it in GitHub Desktop.
Save bryanrsebastian/df871eb0559fb4a25d47f3cf0fc4a6d6 to your computer and use it in GitHub Desktop.
$( document ).ready( function() {
/** Features Recent Posts Search Functionality **/
$( '#__search_recent' ).keyup( function( event ) {
var search = $( this ).val().toUpperCase();
$( '#features_archive .__recent_post_sub_container' ).each( function( index, el ) {
if( $( 'a', el ).text().toUpperCase().indexOf( search ) > -1 ) {
$( el ).show();
// $(".__recent_post_sub_container:nth-of-type(11)").addClass('hide-post');
// $(".__recent_post_sub_container:nth-of-type(12)").addClass('hide-post');
$(".__recent_post_sub_container:nth-of-type(11)").removeClass('hide-post-hidden');
$(".__recent_post_sub_container:nth-of-type(12)").removeClass('hide-post-hidden');
} else {
$( el ).hide();
}
} );
if ( search == '' ) {
$(".__recent_post_sub_container:nth-of-type(11)").addClass('hide-post-hidden');
$(".__recent_post_sub_container:nth-of-type(12)").addClass('hide-post-hidden');
}
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment