Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save champsupertramp/69d78e6692fef8d403a0bd64036d7b88 to your computer and use it in GitHub Desktop.
Save champsupertramp/69d78e6692fef8d403a0bd64036d7b88 to your computer and use it in GitHub Desktop.
Ultimate Member 2.1 - Add search & reset buttons in member directory
<?php
add_action("um_members_directory_head","um_custom_members_directory_head",10, 1 );
function um_custom_members_directory_head( $args )
{
?>
<div class="um-search-submit" style="margin:auto;width:50%;">
<div style="width: 40%;float:left;margin:10px;text-align:center;">
<a href="#" class="um-button um-do-search" ><?php _e("Search","ultimate-member"); ?></a>
</div>
<div style="width: 40%;float:left;margin:10px;text-align:center;">
<a href="javascript:;" class="um-button um-alt um-clear-filters-a"><?php _e("Reset","ultimate-member"); ?></a>
</div>
</div>
<?php
}
@champsupertramp
Copy link
Author

Hi @hirenshah, It should clear the URL parameters and fields without reloading the page. It's like you're clicking the "x" clear all filters button. Please see how it works. It's a single line of code.

Screen-Recording-2020-04-28-at-9

Regards,

@lindsayweb
Copy link

lindsayweb commented Apr 28, 2024

jQuery(".um-directory .um-clear-filters-a").trigger("click"); only clears the filters. I think the reset button should clear the search bar text, too. That little X that appears in the search input is really easy for users to miss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment