• Resolved tosca30

    (@tosca30)


    I’m trying to display a hierarchical taxonomy in the ‘term order’.
    The order is fine in the backend and when using

    wp_dropdown_categories

    function, but the

    get_terms

    order doesn’t seem to work.

    As I couldn’t understand the resulting order, I did some debugging and saw that the sorting order seems to use only to term position in relation to its siblings, and not its parent/place in the hierarchy.

    Is there a way to fix this?

    Thanks for helping.

    https://www.ads-software.com/plugins/custom-taxonomy-order-ne/

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

    (@mpol)

    Hmm, i have seen this too, but I am not sure how to go forward with it.

    Could you give a usecase here, what are you trying to do, what are you getting, and what are you expecting?

    Thread Starter tosca30

    (@tosca30)

    I have this hierarchy of terms:
    Paysage
    |_ Cévennes
    |_ Massif de l’Aigoual
    |_ Vallées cévenoles
    |_ Aubrac
    |_ Hiver
    |_ Autres saisons
    |_ Margeride
    Architecture
    |_ Classique et monumentale
    |_ Moderne et technique
    etc.

    The order/hierarchy is displayed correctly with the wp_dropdown_categories.

    I would like the get_terms function to give the same order, that would be :
    Paysage
    Cévennes
    Massif de l’Aigoual
    Vallées cévenoles
    Aubrac
    Hiver
    Autres saisons
    Margeride
    Architectur
    etc.

    Plugin Author Marcel Pol

    (@mpol)

    Okay, I understand. I will look at it. I have no idea how feasible it is, or what is possible.

    Thread Starter tosca30

    (@tosca30)

    The message formatting lost the hierarchy…
    Basically, I have:
    1. Paysage
    11. Cévennes
    111. Massif de l’Aigoual
    112. Vallées cévenoles
    12. Aubrac
    121. Hiver
    122. Autres saisons
    13. Margeride
    2. Architecture
    21. Classique et monumentale
    etc.

    The idea is to get the terms in the same order, whether the rendering is flat, or with the hierarchy as wp_dropdown_categorie do.

    Plugin Author Marcel Pol

    (@mpol)

    In version 2.6.6 there is functionality that looks reasonable to me.
    I tried to avoid using a Walker, I have the idea that these filters are expensive already.
    What it does now is for a sub-term to start counting not at 0 but at the term_order of the parent-term.
    That will not make it look perfect, but it does make it much more reasonable.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘get_terms doesn't sort properly with hierarchical taxonomy’ is closed to new replies.