Support » Plugin: Custom Taxonomy Order » AJAX reload disrupts sort

  • Resolved altimac


    Hi, this plugin is working great for me and seems like the only solution for what I was trying to do, which was to display the values of three separate categories (size, location, region) on the front end for a CPT, and keep them in order by those parent categories. It works fine, BUT I have AJAX filtering working to change the sort order of the posts on the archive page for my CPT, and once I reload the archive page with a different AJAX sort, the custom category display enable by your plugin no longer works, and they go back to displaying in what appears to be alphabetical order.

    I assume this is because the plugin code is not being loaded on an AJAX sort, just on a regular page reload. Is there any way to accomplish this with your plugin? Thanks again for creating this, it really is pretty awesome 😉

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marcel Pol


    Hi Altimac,

    Always interesting 🙂
    The code of the plugin is quite fiddly, mainly there are two ways of sorting: sorting after the database query has been done, and sorting as part of the query.

    Often the only way to even try to understand what is happening here is to see the code that you use. Is it possible to paste it on some pastebin? Or otherwise send it as a zipfile to ?
    If so, I will be happy to take a look. Maybe the plugins requires a change, maybe your code might require a change.

    Thread Starter altimac


    Thanks, Marcel. I think it was more an issue of my not understanding fully how the parent category sort works vs. the child categories. I thought if I sorted the parent categories in order, that the child terms would fall in line based on the parent term_order value, but that is not the case, and once I did some Googling on the term_order field in wp_terms, I realized that I could manually add sequential values into this field for all the child terms, and then make sure that my sort was by term_order ascending. That worked and also made the parent sort irrelevant. Anyway, thanks for creating the plugin because it did get me halfway there and caused me to figure some things out on my own, so I am a little bit smarter today 😉

    Plugin Author Marcel Pol


    Ah, okay.
    That is a bit of a strange thing to be fair 🙂
    Parents have a term_order with a number (integer) saved in the database. Child terms have a similar term_order.
    To have child terms sorted close after the parent, the child gets a term_order of “parent.child” which is not an integer but a floating number.
    That might interfere with the ajax handler that only sorts on integers when doing the database request, because that float only gets made in the PHP code.

    Anyway, it seems you have it sorted 🙂
    Have a good weekend.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.