How can I check that a resource is child of

Hello

I would like to show only the child of a resouce
I installed the package if

[[If?
	&subject=`[[+wf.docid]]`
	&operator=`isChild of`
	&operand=`27`
	&then=`<li [[+wf.classes]]>
<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]] class="nav-lik">[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>`

How can I write the operator and answer the question: is child of?

I haven’t actually used the If extra before (I tend to use custom snippets or output modifiers), however I assume you could do something along the lines of:

[[If?
	&subject=`[[+wf.parent]]`
	&operator=`=`
	&operand=`27`
	&then=`<li [[+wf.classes]]>
<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]] class="nav-lik">[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>`

So this way you get the parent id from the current resource and check that it equals the number you provide as the operand.

Not sure if i understand this right but could you not just use:

[[*parent:is=`27`:then=`<li [[+wf.classes]]>
<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]] class="nav-lik">[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>`]]

*Untested

1 Like

I’m guessing since it’s using Wayfinder they don’t want the parent of the resource the snippet is on, but if you changed that to the parent placeholder tag it would also work using output modifiers.

i.e.

[[+wf.parent:is=`27`:then=` show stuff `]]
1 Like

Hello
Thanks for all of you reply and sorry for my late answe. I will check that this evning. Let you know

Not sure, what you are trying, but if you want to show the children only of a specific parent, wouldn’t you just set the &startId in wayfinder?

In pdoMenu, it would work with &parents

Dear all
so sorry to not follow my request. I was busy with something else, but many thanks for your suggestion

Le me explain again to answer to your question
If you look at that page https://www.espace-awen.ch/latelier/atelier/en-eutonie.html (the bworser need to be large as for a desktop screem), you can see the sub menu

L’Atelier (ID 27)

  • En Eutonie
  • EGAM
  • T’é parent ?
  • L’Arbre Enchanté
  • Infos Pratiques

The 5 resource are child of l’Atelier (ID: 27), and l’Atelier is chield of L’Atelier (ID7) of the horizontal menu (do not aks me way :slight_smile: ).

If now, you reduce the windows and you click on the bouton slider, click on l’Ateluer (ID7), then you have to click again on l’Atelier (ID:27), and you will see the 5 subenu.

What my client asked me, is to “suppress” the Atelier (ID: 27), only on the slider menu. The goal is when you click on L’Atelier (ID:7), you see the 5 submenu.

Do you see?

I can not “hide from menu” L’Atelier (ID:27) because it will be hiden in deskptop mode.

My initial rowTpl is

<li [[+wf.classes]]>
<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]] class="nav-lik">[[+wf.linktext]]</a>
[[+wf.wrapper]]
</li>

I tried to work with
[[If?
&subject= &operator=
&operand=``
&then=something

, but some of you pasted

[[+wf.parent:is=27:then=show stuff]]

What’s the difference.

My need is, only on slider menu, to ignore the L’Atelier (ID:27) (like hiden form menu), and “jump” directly to the submenu, like if I would move the sumenu from L’Atelier (ID:27) under l’Atelier (ID:7)

Do my clarification is better?

Many thanks

I think you could use two different wayfinder calls. One for the desktop layout and another for the mobile layout. You could do this using ‘media queries’ to show the navigation menu you want for the current screen size.
Something like:

  #div-mobile { display: none; }
  #div-desktop { display: block; }
}
@media screen and (max-width: 768px) {
  #div-mobile { display: block; }
  #div-desktop { display: none; }
}

#div-mobile would contain one wayfinder call
#div-desktop would contain a different wayfinder call

1 Like

Ah I see, yeah Andy’s suggestion is probably how I’d do that too.

The If snippet call and the output modifiers would have the same result. I just prefer output modifiers because they’re more succinct and don’t require installing an extra.

Hello
Yes, it’s what I am doing. I am already using two wayfinder. One for the desktop and on for the slider

For the slider wayfinder, I created two tpl

  • outerTpl
  • rowTpl

and from the slideer wayfinder I would like to find the way to hide the l’Ateler with the id 27 with the goal to have the 5 submenu shown as child of l’Atelier with ID 7

When you open the slider menu, you should see


After clicking on l’Atelier, you should see
Screenshot 2021-03-20 at 08.27.24
and the second step should be skiped
Screenshot 2021-03-20 at 08.27.33

I am sorry, if I explained incorrectly

If I understand correctly then I think that it would be possible to use the ‘hide from menu’ option for resource 27 in conjunction with the &ignoreHidden option.

In the desktop Wayfinder Menu you could use this, which should allow 27 to be displayed:

&ignoreHidden=`1`

In the slider menu you could leave the default, which equates to the code below, and should cause 27 not to be displayed:

&ignoreHidden=`0`

Try this as your rowTpl:

<li [[+wf.classes]]>
<a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]] class="nav-lik">[[+wf.linktext]]</a>
[[+wf.docid:is=`27`:then=`[[Wayfinder? &startId=`7`]]`:else=`[[+wf.wrapper]]`]]
</li>
1 Like

or better the mosquito thing:

[[[[+wf.docid:is=`27`:then=`Wayfinder? &startId=`7` `:else=`+wf.wrapper`]]]]

otherwise the inner wayfinder is allways executed

1 Like

That’s great, thanks
@halftrainedharry and @bruno17 solution work!!

Thanks

1 Like