Title: Hierarchical data structure
Last modified: June 18, 2020

---

# Hierarchical data structure

 *  Resolved [Fiable.biz](https://wordpress.org/support/users/fiablebiz/)
 * (@fiablebiz)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/hierarchical-data-structure/)
 * Hello.
 * I’m new to pods and would like to imitate the following law site, in simpler:
   
   [legifrance: block with 1 article](https://www.legifrance.gouv.fr/affichCode.do?idSectionTA=LEGISCTA000030461892&cidTexte=LEGITEXT000006073984&dateTexte=vig),
   [legifrance : block with 2 articles](https://www.legifrance.gouv.fr/affichCode.do?idSectionTA=LEGISCTA000006128455&cidTexte=LEGITEXT000006073984&dateTexte=vig).
   At this stage, ignore the sidebar (versioning and rolling table of content). 
   You will note a path (“chemin”, in French) at the top, and hyperlinks to children
   pages below the article(s). Moreover, if you click on “Code des assurances” (
   after “chemin”), the legal text name (in this case “code of insurance”), you 
   get a table of contents of the text: [table of contents](https://www.legifrance.gouv.fr/affichCode.do?cidTexte=LEGITEXT000006073984&dateTexte=vig).
   At the bottom, you have 2 links: “<< Bloc précédent – Bloc suivant >>”, meaning“
   previous block (of articles)” and “next block”. So blocks may have their own 
   articles, as well as children blocks. I created advanced custom content types
   for articles, for blocks and for legal texts, with bi-directional relationship
   fields between a legal text and its blocks, between a block and its articles,
   between a block and the next block. I will also need a bidirectional relationship
   between a block and its children blocks. My problem is how to manage the order?
   For instance, for a block, I want to list its children IN THE RIGHT ORDER (i.
   e. the order they have in the legal text itself). Unlike legifrance, I don’t 
   intend to enter full legal texts inside my database, but only extracts, plus 
   the titles of big parts, and I don’t want to renumber manually the blocks or 
   articles each time I insert a new one between 2 ones which are already in the
   database. Ideally, I would like the articles and blocks to get ordered automatically
   according to their official legal number. For instance, L300-1 is before L364-
   2 but after L127-2-1. Would you have any advice for the data structure?
 * Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/hierarchical-data-structure/#post-13003526)
 * I’d advice to go for PHP and not Pods templates.
    With WP_Query parameters you
   can easily set custom sorting by various type of attributes/properties. More 
   info on WP_Query: [https://developer.wordpress.org/reference/classes/wp_query/](https://developer.wordpress.org/reference/classes/wp_query/)
 * Cheers, Jory
 *  Thread Starter [Fiable.biz](https://wordpress.org/support/users/fiablebiz/)
 * (@fiablebiz)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/hierarchical-data-structure/#post-13183251)
 * Hello. I don’t understand why I was not notified when you posted. Thank you very
   much. Do you mean I shouldn’t use Pods at all? I need new fields and, later on,
   I would like to use that legal database in more than one website. So Pods advanced
   content type seemed to me an appropriate tool.
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/hierarchical-data-structure/#post-13185259)
 * Hi [@fiablebiz](https://wordpress.org/support/users/fiablebiz/)
 * No you’d still need Pods for the creation and management of fields.
    Also, I 
   missed that you were using advanced content types. In that case you cannot use
   WP_Query. Please check Pods find: [https://docs.pods.io/code/pods/find/](https://docs.pods.io/code/pods/find/)
   You do need some SQL knowledge to continue with this though as this will result
   in some more complex `where` statements.
 * Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Hierarchical data structure’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

## Tags

 * [bidirectional](https://wordpress.org/support/topic-tag/bidirectional/)
 * [cpt](https://wordpress.org/support/topic-tag/cpt/)
 * [data structure](https://wordpress.org/support/topic-tag/data-structure/)
 * [Relationship](https://wordpress.org/support/topic-tag/relationship/)

 * 3 replies
 * 2 participants
 * Last reply from: [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/hierarchical-data-structure/#post-13185259)
 * Status: resolved