wp-tag-order icon indicating copy to clipboard operation
wp-tag-order copied to clipboard

Tag order for hierarchical taxonomy

Open FabienArr opened this issue 1 year ago • 12 comments

Hello,

What a nice plug-in ! After many weeks, i found your plug-in, i tried and it's what i need. But, do you think it could be possible to apply that to a hierarchical taxonomy ?

Regards

FabienArr avatar Mar 08 '23 11:03 FabienArr

@FabienArr Thanks for your feedback.

Unfortunately I don't think it's possible because the order terms in hierarchical taxonomy have a different structure.

sectsect avatar Mar 08 '23 12:03 sectsect

Thank you for your fast reply. I don't explore yet your sources, but what i analyse in the database, it's that there is no difference in wordpress storage between hierarchical and non-hierarchical taxonomy.

image

The only difference, it's in the metabox to choose the taxonomy which are checkboxes and not input.

FabienArr avatar Mar 08 '23 13:03 FabienArr

@FabienArr What makes this difficult is the different HTML structure between hierarchical and non-hierarchical taxonomy in Meta Box of the edit page, not the database structure.

sectsect avatar Mar 08 '23 14:03 sectsect

It's about your Meta Box or Wordpress Meta box ?

FabienArr avatar Mar 08 '23 14:03 FabienArr

@FabienArr It's about WordPress Meta Box.

sectsect avatar Mar 08 '23 14:03 sectsect

Ok, you launch your script on "Add" button but with hierarhical there is no button "Add" so it needs to track each checkbox, it's that ?

FabienArr avatar Mar 08 '23 15:03 FabienArr

@FabienArr that's right. There are structural differences. This plugin specializes in non-hierarchical taxonomy. If we need hierarchical taxonomy support, I think it should be developed as a separate plugin.

sectsect avatar Mar 08 '23 15:03 sectsect

Ok, could you just tell me if i'm right : You detect changes in taxonomy list with eventlistener :

jQuery("[id^='tagsdiv-']")
      .find('.tagchecklist')
      .on('DOMSubtreeModified propertychange'

And after you do a request to get the terms of the taxonomy ?

Can we just add another listener on input modification ? because checked is like that : <input value="25" type="checkbox" name="tax_input[localisation][]" id="in-localisation-25">::before</input>

and unchecked like this : <input value="25" type="checkbox" name="tax_input[localisation][]" id="in-localisation-25">

But when we checked, the database is not update i think.

FabienArr avatar Mar 08 '23 15:03 FabienArr

@FabienArr

And after you do a request to get the terms of the taxonomy ?

Submit request after detect changes in taxonomy list.

Since this plugin is not supposed to support hierarchical taxonomy in the first place, I'll have to check that. Sorry, but I don't have enough time to test to answer this right now.

sectsect avatar Mar 08 '23 17:03 sectsect

@sectsect Thanks for your reply, i will try to work on it, it could be interesting to add this feature in your plug-in. For me the only problem is what i describe, values of checboxes are not store directly via ajax request, but on submit button which reload the page, it's a constraint but at reloading we can have all the terms and we could order them.

FabienArr avatar Mar 09 '23 13:03 FabienArr

@FabienArr Thanks for your feature request. There are some issues such as how to handle nested terms (whether to maintain the hierarchical structure and enable sorting), etc., but I think it would be great if it could be implemented.

I will consider the implementation, including whether it can be implemented.

sectsect avatar Mar 09 '23 17:03 sectsect

@sectsect If think it's not the goal to maintain the hierarchical order structure because Wordpress doesn't keep it. Thanks for considering the request, i can help you, if you want.

FabienArr avatar Mar 10 '23 07:03 FabienArr