How to target all Categories with parent ID == '#'

TradingboTradingbo Posts: 21Member
edited May 3 in Customizations

Hi everyone,

Relatively new to LS & .rain and trying to get my head around something.

How to target all sub-categories within a given parent category using rain/twig in a given template.

Am trying to achieve something akin to this:


{% if category.textpage and parent.category_id == '8661854' } 

<script type="text/javascript">

// do something

</script>

{% endif %}


Can't seem to make the syntax work for some reason. Can anyone point me in the right direction?

The only reference to parent cats i can find in the documentation is this:

categories.{{ category.id }}.parent

Which presumably only returns the parent of a single specific category.

( also slightly confused about how to express the ID in this example as: {{categories.{{ ' 8661854'}} .parent}} returns a fatal error ( as two sets of curly brackets).

Many Thanks,

Answers

Sign In or Register to comment.