8 – Get hierarchical content

I have a content type Article and have two vocabularies Book and Chapter.
The two vocabularies are fields of entity reference in Article.
There is no direct relation between the Book and Chapter.

Now I need to get the Articles, based on Book then group them under chapter.
Can I do this in Views module?

The Structure will be like below:
Book - Chapter - Article

Please note, I can’t use Books Module.

grid – If it’s possible to combine plain and hierarchical view together?

I’m facing the issue of data representation. On the same page, it’s possible to view both plain and tree structure. It’s ok (tbh no, but we can live with it for a while), but when it comes to new object creation it feels like a duplication as it appears in two places.

  1. As nested object
  2. As an object in the list

Any idea how to solve it? How to get rid of the feeling of duplicated object? Keeping the plain and tree structure on the same page?


short gif

database design – Hierarchical data using closure table, how to ensure that a column is unique within the parent node?

I store hierarchical data in a Node-table, combined with a closure table (NodeClosure). Each node has a column “name” that should be unique among the sibling nodes (link to parent-Node + name should be unique).

This is definition of the tables:

  • Table “Node”
    • Column “nodeID” (int not null, autoincrement, primary key)
    • Column “name” (text not null)
  • Table “NodeClosure”
    • Column “ancestorID” (int not null, primary key, foreign key to Node)
    • Column “descendantID” (int not null, primary key, foreign key to Node)
    • Column “depth” (int not null)

For each parent node, I want the names of its direct child nodes to be unique for that parent node.

Do I have to add a parentID-column to Node (and duplicate the parent/child information) to be able to add a unique index on parentID + name, or is there a different solution?

hierarchical – Simultaneous infinite vertical scrolling and horizontal scrolling on a page

I want to create a collaboration hierarchy that allows for infinite threading of parent/child relationships. To do so would require a page that enables both vertical scrolling and horizontal scrolling simultaneously.

Also, is lazy loading possible in a situation like this?

Thanks to anyone who can offer a solution.

hierarchy – Display suggestions for hierarchical checkbox lists (trees)

I’m working on a web-app for a document management system where employees upload documents and associate them with metadata. In many cases, we are able to predict certain metadata properties and we would like to suggest those predictions to the user.

For normal text-input fields, this is not a problem as we simply use auto-suggest. However, a lot of times, we do not use text-input fields but hierarchical checkbox lists (see image below).

We are unable to find a satisfactory method to display suggestions in these cases.

Assume the following fictional scenario: We are a manufacturing company. At the end of each day, every employee uploads a short work-report. After uploading the document, the employees have to select the machine(s) they were working with:

enter image description here

Now comes the challenge: From the working plan we actually know that on 26.05.2020, James Smith is supposed to work with the CNC Machine. However, we also know that he was working with another machine in Manufacturing Plant XX for the last days.

We would like to suggest both machines to him while still giving him the possibility to pick every other machine.

  • Solution 1: Auto-select button

    Add a button that automatically selects the n most likely nodes when clicked.

    • Con’s:
      • Not really a suggestion
      • The value for n is not clear
      • Users have to de-select wrong suggestions
  • Solution 2: Suggestion dialog

    Add a button that opens another dialog from which the user can pick suggested nodes.

    • Pro’s:
      • Gives the users the ability to pick the right suggestions
    • Con’s:
      • Opens a dialog on top of a dialog
      • Distracts the workflow
  • Solution 3: Highlight the suggested nodes

    Highlight the suggested nodes and expand their parent-nodes to make them visible.

    • Pro’s:
      • Relatively subtle
      • Does not distract the users too much
    • Con’s:
      • Could be unclear for the users
      • Does not reduce the number of clicks for the users
  • Solution 4: Auto-suggest in the filter

    Add auto-suggest to the filter text-input.

    • Pro’s:
      • Does not distract the user
    • Con’s:
      • Only available if the user uses the filter
      • Requires the most interaction

Does anybody know a good solution for problems like this?

php – Hierarchical taxonomy list with transformated links

I have two functions displaying a term list of the selected taxonomy:

First function:

$terms = get_the_terms(get_the_ID(), 'MY_TAXONOMY');
if (!is_wp_error($terms) && !empty($terms)) {
    foreach ($terms AS $term) {
        $name = $term->name;
        $link = add_query_arg('fwp_typ', FWP()->helper->safe_value($term->slug), 'https://www.MYWEBSITE.com/');
        echo "<a href='$link'>$name</a><br />";

Second function:

    global $post;
    $taxonomy = 'MY_TAXONOMY';
    $terms = wp_get_post_terms( $post->ID, $taxonomy, array( "fields" => "ids" ) );
    if( $terms ) {
        echo '<?ul>';
        $terms = trim( implode( ',', (array) $terms ), ' ,' );
        wp_list_categories( 'title_li=&taxonomy=' . $taxonomy . '&include=' . $terms );
        echo '<?/ul>';

The first one ignores the hierarchy, but transforms the links as I need, i.e. so that they lead to queries of the WP’s Facet Plugin. I understand that this line is key here:

$link = add_query_arg('fwp_typ', FWP()->helper->safe_value($term->slug), 'https://www.MYWEBSITE.com/');

The second one includes the hierarchy, but the links don’t lead where I would like. How do I make this second function transform links like the first one?

Hierarchy – A hierarchical process

Suppose we have a system that you can use to modulate a process and track its status and current tasks.
1. The process has top-level group name levels
2. Each level can contain groups (no more than two nested groups).
3. Each phase or group can contain one or more tasks that are performed sequentially or in parallel

What view would you use to create such a process: board, left window tree + main grid, tree grid or other?

Lists – display of hierarchical data on 3 levels

I'm revising an existing desktop website user interface. I need to display 3 levels of hierarchical data. There are categories that contain parents (with different characteristics), which in turn contain children (also with different characteristics).

I'm not thrilled with this presentation, but I can't think of anything better. I could put each layer on a separate page and use a breadcrumbs like navigation, but there's a fair bit of movement between the layers (parents can be moved to different categories and children can be moved to different parents).

Any ideas?


Categories – Best Practice: Many hierarchical vs. few non-hierarchical taxonomies

I'm going to create a site that will eventually host thousands of posts of the same custom artwork type.

Each blog post is assigned several custom taxonomy terms, e.g. "Artist", "Project", "Art Director", "Format" and more.

I read that too many taxonomies and / or terms can slow down the page. So I'm not sure if I should create a structure with many non-hierarchical taxonomies or with only one or two hierarchical taxonomies, but more terms and subordinate terms.

Many taxonomies, mostly not hierarchical:

 • Artist Taxonomy (non-hierarchical): 1000s of terms (1 per post)
 • Formats Taxonomy (hierarchical):
   – Formats Terms: 4 terms (1 per post)
     –Format Child-Terms: 15 terms (1 per post)
 • Projects Taxonomy (non-hierarchical): 100s of terms (1 per post)
 • Artdirectors Taxonomy (non-hierarchical) 100s of terms (1 per post)
 • Genres Taxonomy (non-hierarchical): 20 terms (1-3 per post)
 • Collections Taxonomy (hierarchical):
   – Collections Terms: 50 terms (0-1 per post)
     - Collection Child-Terms: 100-200 terms (0-5 per post)
 • Publisher Taxonomy (non-hierarchical): 30-40 terms (0-1 per post)


Less taxonomies, but hierarchical:

 • Artist Taxonomy (non-hierarchical): 1000s of terms (1 per post)
 • Meta/Collections Taxonomy (hierarchical):
   – Formats Terms: 4 terms (1 per post)
     –Format Child-Terms: 15 terms (1 per post)
   – Projects Term:
     – Project Child-Terms: 100s of child-terms (1 per post)
   – Genres Term:
     – Genre Child-Terms: 20 child-terms (1-3 per post)
   – Artdirectors Term:
     – Artdirector Child-Terms: 100s of child-terms (1 per post)
   – Collections Term:
     – Collection Child-Terms: 50 terms (0-1 per post)
       – Collection Grandchild: 100-200 grandchild-terms (0-5 per post)
    – Publisher Term:
       – Publisher Child-Terms: 30-40 child-terms (0-2 per post)

Is there an advantage / disadvantage to either of these structures in terms of website speed? I'm worried that it could be slow when there are thousands of posts on the page.

Graphics programming – creating hierarchical transformation matrices with motion detection data on a skeleton

I'm trying to draw the bones of a skeleton that is animated by motion detection data. I rotate the bones from "bone space" to "rotation axis space". Then apply the rotation of the current pose. Turn it back into "bone space" and then transform the vertices into the parent space of the bone. I draw an axis on each bone to test my current transformation matrix. With the code below it works almost great. The problem is that there appears to be a double axis (bone) that is pulled around the chest area, and it appears that the spine and certain joints are very slightly "squeezed" or rotated incorrectly. I feel that this has to do with the order of my matrix multiplication, but I cannot understand which transformation I am doing out of order.

    Matrix4 axes_space = skeleton_.BoneSpaceToRotAxesSpace(bone_name);
    Matrix4 thisPose = pose_.JointRotation(bone_name);
    Matrix4 bone_space = skeleton_.RotAxesSpaceToBoneSpace(bone_name);
    Matrix4 ctm = parent_transform * axes_space * thisPose * bone_space;

    Matrix4 S = Matrix4::Scale(Vector3(0.15,0.15,0.15));
    quick_shapes_.DrawAxes(ctm * S, view_matrix, proj_matrix);

    Matrix4 child_root_transform = ctm * Matrix4::Translation(skeleton_.BoneDirectionAndLength(bone_name));

    for (int i=0; i

EDIT: An image with the problem has been added. The arms should be straighter on their side, which would turn both shoulder axes equally. Instead, do they seem almost opposite? If instead I draw a ball for each bone, the problem is much more difficult to notice.

Rest position