• Hello,
    This is how I have my taxonomy setup:

    register_taxonomy(
    	    	'interest-filter',
    	    	'page',
    	    	array( 'hierarchical' 	=> true,
    	    		   'labels' 		=> $labels,
    	    		   'query_var' 		=> true,
    	    		   'rewrite' 		=> true
    	    	)
    	    );

    And I don’t see a meta box on the edit post page to set the order of the terms. I guess it would be difficult to order something that appears in multiple terms, but your plugin doesn’t mention that it is limited to non-hierarchical taxonomies. Is it?

    https://www.ads-software.com/extend/plugins/custom-taxonomy-sort/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Drew Baker

    (@dbaker)

    Looking into this, it seems that this only lets you order terms, not actually order posts/pages that are tagged with the terms. Is that right?

    Plugin Author Zack Tollman

    (@tollmanz)

    Hi Drew,

    The intention of the plugin is to define the order that taxonomy terms are displayed using the built in WordPress term functions like get_terms, get_the_terms, get_the_term_list, etc. WordPress does not include a way to order these terms and that is what this plugin intends to do. It does indeed work on hierarchical taxonomy terms.

    Unfortunately, this plugin has no effect on the ordering of pages or posts; however, there can be ways to use this to do something like this.

    I am very interested in your use case. What are you trying to accomplish? If it fits with the goals and the scope of the plugin, I might consider trying to add the functionality to the plugin. Let me know and I’d be happy to talk about it.

    Thread Starter Drew Baker

    (@dbaker)

    Hello Tollmanz,
    Thanks for the reply. I’ll try to walk you through what I’m trying to do:

    I’m building a photography site. Each photo is it’s own page in a hierarchical taxonomy. For example:

    Cars
    – – BMW
    – – Ford
    Speed
    – – Fast
    – – Slow

    So a photo of a fast BMW will be in the ‘Cars’, ‘BMW’, ‘Speed’ and ‘Fast’ terms. I’d like to be able to order each page in each term. So when looking at the term page for ‘Fast’ I can set the order, and when looking at BMW I can set an order too etc.

    That real life example is a little more messy. This is a term page for photos tagged with “luxurious”:
    https://www.trevorpearson.com/dev/interest-filter/luxurious/

    I’d like to be able to set the order that they appear (like menu_order).

    Now, several of the same photos are also tagged with the term “interior” and are shown here:
    https://www.trevorpearson.com/dev/interest-filter/auto-interiors/

    So I’d like to be able to set an order for this term as well that was separate to the order set for ‘Luxurious’.

    I’m not even sure if it’s possible. I think you’d have to create a custom-field for each page that then stores the term and the page order for that term in an array. My thoughts were something like this:

    $key = term;
    $value = order;
    
    custom_order = array(
       'BMW'       => '3',
       'Fast'      => '20',
       'Interior'  => '7',
       'Luxurious' => '12'
    );

    That way you have a page order stored for each term that is applied to the page. The problem would be that WordPress’s admin pages aren’t really setup to allow multiple page ordering, so I’m not sure how to deal with that. You wouldn’t want to have to enter in the order on each “Edit page” page, you’d want to tie it into some sort of drag-and-drop page order plugin that worked on term pages.

    Plugin Author Zack Tollman

    (@tollmanz)

    Drew,

    This is a very interesting case. You certainly want a lot of control over the display of the photos.

    You are right, one method would be to use custom fields to precisely define the order for each page…that would be a huge…check that…HUGE pain!

    Will your order be based on the taxonomy term order? For instance, will you always want the order to be static? Perhaps you want to always show the following order, from first to last:

    Cars > BMW > Ford > Speed > Fast > Slow

    If this is the case, you can utilize my plugin in combination with custom templates to make this fly. Generally speaking, you would do the following:

    1) Set the taxonomy term order using my plugin
    2) On a template page:
    1) Get all of the terms (they should be in the order you specify), using get_terms
    2) Loop through these terms
    3) Set up a separate query for each term using the tax_query parameter to get only the terms associated with the current term
    4) Use a standard loop to display those terms’ associated photos

    The big drawback to this method is the increased number of queries, which will result in a performance hit. You could even write your own custom query to get these results I suppose, but that can get a bit ugly and if not done right, you lose the power of the WordPress built in functions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Custom Taxonomy Sort] Not working with hierarchical taxonomy’ is closed to new replies.