diff --git a/readme.txt b/readme.txt index 846534a..8a5a50f 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: johnjamesjacoby, stuttter Tags: jquery, filter, select, filters Requires at least: 4.3 -Tested up to: 4.7 -Stable tag: 1.0.0 +Tested up to: 4.8 +Stable tag: 1.1.0 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9Q4F4EL5YJ62J == Description == @@ -44,7 +44,7 @@ WP Pretty Filters makes post filters better match what's already in Media & Atta = What dropdowns does this target? = ` -#posts-filter .tablenav.top .actions:not(.bulkactions) +.tablenav.top .actions:not(.bulkactions) ` = Where can I get support? = @@ -57,6 +57,12 @@ http://github.com/stuttter/wp-pretty-filters/ == Changelog == += 1.1.0 - 2017/05/09 = +* Support users, BuddyPress, and more +* Hide secondary user role assignment +* Hide pretty filters if empty +* Load in wp_head to avoid DOM jitter + = 1.0.0 - 2016/09/13 = * Chosen Support * Stable release diff --git a/wp-pretty-filters.php b/wp-pretty-filters.php index a474c36..30f4ba8 100644 --- a/wp-pretty-filters.php +++ b/wp-pretty-filters.php @@ -8,7 +8,7 @@ * License: GPL v2 or later * License URI: https://www.gnu.org/licenses/gpl-2.0.html * Text Domain: wp-pretty-filters - * Version: 1.0.0 + * Version: 1.1.0 * Description: Makes post filters match Media & Attachments */ @@ -27,8 +27,8 @@ function _wp_pretty_filters() { $ver = wp_pretty_filters_get_asset_version(); // Styles - wp_enqueue_style( 'wp-pretty-filters', $url . 'assets/css/pretty-filters.css', array(), $ver ); - wp_enqueue_script( 'wp-pretty-filters', $url . 'assets/js/pretty-filters.js', array( 'jquery' ), $ver, true ); + wp_enqueue_style( 'wp-pretty-filters', $url . 'assets/css/pretty-filters.css', array(), $ver ); + wp_enqueue_script( 'wp-pretty-filters', $url . 'assets/js/pretty-filters.js', array( 'jquery' ), $ver ); } add_action( 'admin_enqueue_scripts', '_wp_pretty_filters', 11 ); @@ -51,5 +51,5 @@ function wp_pretty_filters_get_plugin_url() { * @return int */ function wp_pretty_filters_get_asset_version() { - return 201609130002; + return 201705090001; } diff --git a/wp-pretty-filters/assets/css/pretty-filters.css b/wp-pretty-filters/assets/css/pretty-filters.css index 9580c86..d8ce0e4 100644 --- a/wp-pretty-filters/assets/css/pretty-filters.css +++ b/wp-pretty-filters/assets/css/pretty-filters.css @@ -1,8 +1,6 @@ .wp-pretty-filters { - float: none; clear: both; - display: inline-block; position: relative; -webkit-box-sizing: border-box; @@ -19,5 +17,10 @@ } .wp-pretty-filters .chosen-container { + margin-right: 4px; +} + +.wp-pretty-filters .chosen-container + input, +.wp-pretty-filters .chosen-container + button { margin-right: 8px; } diff --git a/wp-pretty-filters/assets/js/pretty-filters.js b/wp-pretty-filters/assets/js/pretty-filters.js index e6efd48..cc43446 100644 --- a/wp-pretty-filters/assets/js/pretty-filters.js +++ b/wp-pretty-filters/assets/js/pretty-filters.js @@ -1,22 +1,35 @@ jQuery( document ).ready( function( $ ) { 'use strict'; - // Look for posts - var toptablenav = $( '#posts-filter .tablenav.top' ); + // Look for top tablenav + var toptablenav = $( '.tablenav.top' ); - // Maybe try comments + // Bail if no toptablenav if ( ! toptablenav.length ) { - toptablenav = $( '#comments-form .tablenav.top' ); + return; } - // Only proceed if toptablenav was found - if ( toptablenav.length ) { - var filters = toptablenav.find( '.actions:not(.bulkactions)' ); + // Look for actions that aren't bulk + var filters = toptablenav.find( '.actions:not(.bulkactions)' ); - // Add a class for custom styling - filters.addClass( 'wp-pretty-filters' ); + // Bail if no filters + if ( ! filters.length ) { + return; + } + + // Add a class for custom styling + filters.addClass( 'wp-pretty-filters' ); - // Relocate - toptablenav.before( filters ); + // Relocate + toptablenav.before( filters ); + + // Hide if pretty filters is empty + if ( ! $.trim( filters.html() ) ) { + filters.hide(); } + + // Maybe hide the users bottom tablenav + $( 'body.users-php .tablenav.bottom' ) + .find( '.actions:not(.bulkactions)' ) + .hide(); } );