• Resolved Pt

    (@bncpeter)


    I’ve noticed that the Clear All button seems to only show up intermittently on one of my client’s sites.
    Some testing just now seems to indicate that the Clear All button is only shown when the first of the five select lists (Sectors) is used. If no Sector filter is selected, only the Filter button is shown.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Pt,

    Hmm okay. Before I dig down in debug mode.. Do you have any cache going on? If so, could you try disabling it just to see if it is what is interfering with the button 🙂

    Thread Starter Pt

    (@bncpeter)

    Hi Jonathan,

    yes, I’m using Litespeed Cache. I’ve disabled it just now and it doesn’t seem to have made a difference (at least not immediately). I’d like to turn it back on as soon as possible.

    Updating to the latest version and purging did seem to fix a separate issue where by BTF wouldn’t work the first one or two times, FYI.

    Plugin Author Jonathandejong

    (@jonathandejong)

    Alright I’ll take a look at the buttons mysterious absence then 🙂

    @bncpeter – how did you add the Clear All button? I am also needing to add this to reset the filters on my site. Any help would be greatly appreciated.

    Thread Starter Pt

    (@bncpeter)

    @cravesa It’s one of the options in the plugin’s Advanced Options.
    (your-site-URL)/wp-admin//options-general.php?page=taxonomy-filters&tab=advanced

    Look for a checkbox labeled Enable a “Clear all” link:

    Plugin Author Jonathandejong

    (@jonathandejong)

    Pt,
    could you post the code for how you register one or two of the taxonomies that do not work?

    The reset filter link would only appear if the setting is on and the conditional for is_btf_filtered() is true so I’d like to doublecheck that the function is working properly. I think it’s possible it has to do with the parameters of register_taxonomy().

    Another thing you could try is adding this to your archive template and tell me what is the result on a working and nonworking filtered page:

    <?php echo ( is_btf_filtered() ) ? 'Filtered!' : 'Not filtered!'; ?>

    Thread Starter Pt

    (@bncpeter)

    Thanks Jonathan,
    I added that line with a slight modification so it isn’t obvious to visitors. It is immediately after the h3 titled “Filter projects by” if you’d like to play with it yourself.
    <?php echo ( is_btf_filtered() ) ? '<pre class="btf-debug" style="display:none;">Filtered</pre>' : '<pre class="btf-debug" style="display:none;">Not filtered</pre>'; ?>

    Based on limited testing, when the Clear All button is not shown the result is “Not filtered”.

    All of the taxonomies should be pretty much the same setup. I used GenerateWP to create them, though that was a few years ago now. Here is an example:

    if ( ! function_exists( 'state_taxonomy' ) ) {
    
    // Register State Taxonomy for Projects
    function state_taxonomy() {
    
    	$labels = array(
    		'name'                       => _x( 'State', 'Taxonomy General Name', 'text_domain' ),
    		'singular_name'              => _x( 'State', 'Taxonomy Singular Name', 'text_domain' ),
    		'menu_name'                  => __( 'States', 'text_domain' ),
    		'all_items'                  => __( 'All States', 'text_domain' ),
    		'parent_item'                => __( 'Parent State', 'text_domain' ),
    		'parent_item_colon'          => __( 'Parent State:', 'text_domain' ),
    		'new_item_name'              => __( 'New State Name', 'text_domain' ),
    		'add_new_item'               => __( 'Add New State', 'text_domain' ),
    		'edit_item'                  => __( 'Edit State', 'text_domain' ),
    		'update_item'                => __( 'Update State', 'text_domain' ),
    		'view_item'                  => __( 'View State', 'text_domain' ),
    		'separate_items_with_commas' => __( 'Add one or more states (used for filtering)', 'text_domain' ),
    		'add_or_remove_items'        => __( 'Add or remove states', 'text_domain' ),
    		'choose_from_most_used'      => __( 'Choose from the most used', 'text_domain' ),
    		'popular_items'              => __( 'Popular States', 'text_domain' ),
    		'search_items'               => __( 'Search States', 'text_domain' ),
    		'not_found'                  => __( 'State Not Found', 'text_domain' ),
    		'no_terms'                   => __( 'No states', 'text_domain' ),
    		'items_list'                 => __( 'States list', 'text_domain' ),
    		'items_list_navigation'      => __( 'States list navigation', 'text_domain' ),
    	);
    	$rewrite = array(
    		'slug'                       => 'state',
    		'with_front'                 => true,
    	);
    	$args = array(
    		'labels'                     => $labels,
    		'hierarchical'               => false,
    		'public'                     => true,
    		'show_ui'                    => true,
    		'show_admin_column'          => true,
    		'show_in_nav_menus'          => true,
    		'show_tagcloud'              => true,
    		'query_var'        	         => 'state',
    		'rewrite'                    => $rewrite,
    	);
    	register_taxonomy( 'statetaxonomy', array( 'badge_proj_post_type' ), $args );
    
    }
    add_action( 'init', 'state_taxonomy', 0 );
    
    }
    
    Plugin Author Jonathandejong

    (@jonathandejong)

    Okay so my suspicion was correct that the issue is a falsely triggered “false” from is_btf_filtered().

    I notice you use rewrite and query_var different from the actual registered taxonomy name. Do you also do that to the Sectors taxonomy? Because I think that might be the issue!

    Could you do me one more favor.
    In beautiful-taxonomy-filters/includes/api.php inside the is_btf_filtered() function could you add these lines:

    
    error_log( print_r( $taxonomies, true ) );
    error_log( print_r( $wp_query->query, true ) );
    

    after global $wp_query; on line 20.

    Also make sure your WP_DEBUG is on and not set to show on frontend:

    
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);
    

    Then paste the debug.log contents created in wp-content in your FTP. Or use a pastebin and post the link or something 🙂

    Plugin Author Jonathandejong

    (@jonathandejong)

    Nevermind,
    I figured I’d might as well do it myself 🙂

    This has been fixed and the new version is up in a few minutes (2.3.5).
    Along with shortcode support for the dinosaurs out there!

    Thread Starter Pt

    (@bncpeter)

    Thanks Jonathan,
    yep, that’s fixed it!
    (installing 2.3.6)

    Also, FYI, it’s still reporting as only compatible up to: 4.8.7. I’m getting a not tested with your version of WordPress warning.

    Cheers,
    Pt.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Missing Clear All’ is closed to new replies.