• Resolved pickme

    (@pickme)


    Hi,

    I enabled the drag and drop sorting feature for a taxonomy and I ordered the terms of that taxonomy into my desired position. However, I am facing 2 issues:

    In WP backend taxonomy page when I click the ‘name’ tab to sort them by name:

    1. My desired sorting is lost without the ability to regain it.
    2. The drag and drop sorting feature gets disabled even though the taxonomy is included in the enabled Taxonomies field.

    I thought that after ordering terms into a desired position, then I would be able to sort them by name (for backend management reasons eg to check the number of posts a term is linked to.

    The solution for this is to reload the page taxonomy page without any query string containing the orderby sort parameter in the URL. Is the there a way to sort list of terms in ascending order by clicking the name tab and then setting my desired order?

    Thank you

    • This topic was modified 3 years, 1 month ago by pickme.
    • This topic was modified 3 years, 1 month ago by pickme.
    • This topic was modified 3 years, 1 month ago by pickme.
    • This topic was modified 3 years, 1 month ago by pickme.
    • This topic was modified 3 years, 1 month ago by pickme.
    • This topic was modified 3 years, 1 month ago by pickme.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Tracy Levesque

    (@liljimmi)

    ?????? YIKES, Inc. Co-Owner

    Hello @pickme

    We are very sorry, but there has been an issue with the plugin since WordPress 5.9. We thought it would be resolved with today’s update but it wasn’t. We need to look further into the issue.

    Thank you.
    -Tracy

    Adnan Moqsood

    (@adnanmoqsood)

    Hi @pickme @liljimmi,

    I was also facing the same issue, but I did modify the plugin code into functions.php and now everything is working fine for me.

    // Set Default Order for the Admin Selected Taxonomies
    add_action( 'init','ct_jobs_front_end_order_terms');
    function ct_jobs_front_end_order_terms() {
    	if (is_admin()) {
    		add_filter( 'terms_clauses', 'ct_jobs_set_tax_order', 10, 3 );
    	}
    }
    // Set Order Function
    function ct_jobs_set_tax_order( $pieces, $taxonomies, $args ) {
    	foreach ( $taxonomies as $taxonomy ) {
    		if ( ct_jobs_is_taxonomy_ordering_enabled( $taxonomy ) ) {
       				global $wpdb;
    				$join_statement = " LEFT JOIN $wpdb->termmeta AS term_meta ON t.term_id = term_meta.term_id AND term_meta.meta_key = 'tax_position'";
    				if ( ! ct_jobs_does_substring_exist( $pieces['join'], $join_statement ) ) {
    					$pieces['join'] .= $join_statement;
    				}
    				$pieces['orderby'] = 'ORDER BY CAST( term_meta.meta_value AS UNSIGNED )';
    		}
    	}
    	return $pieces;
    }
    // Check if the taxonomy is selected in plugin setting
    function ct_jobs_is_taxonomy_ordering_enabled( $tax_slug ) {
    	$option_default = array( 'enabled_taxonomies' => array() );
    	$option         = get_option( 'yikes_simple_taxonomy_ordering_options', $option_default );
    
    	if ( isset( $option['enabled_taxonomies'] ) ) {
    		$option = array_flip( $option['enabled_taxonomies'] );
    
    		return isset( $option[ $tax_slug ] );
    	}
    
    	// Return false if the option doesn't exist.
    	return false;
    }
    function ct_jobs_does_substring_exist( $string, $substring ) {
    	return strstr( $string, $substring ) !== false;
    }

    @adnanmoqsood super thanks for figuring this out, saved me many hours of frustration. Lets hope they fold this into the plugin as an update very soon!

    Plugin Contributor Tracy Levesque

    (@liljimmi)

    ?????? YIKES, Inc. Co-Owner

    Hi @adnanmoqsood

    Thank you so much for finding a fix.

    We hope to have this resolved in the plugin soon.

    -Tracy

    Hi all,

    Just pushed an update on this. Please let us know if you are still seeing issues after updating.

    Thanks,
    Jon

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Name tab > Sorting is lost’ is closed to new replies.