Questions tagged [children]
The children tag has no usage guidance.
40
questions
4
votes
2
answers
2k
views
How do I find the closest parent entry with an Assets field filled in?
I have a structure that goes up to 4 levels deep. Each page has a field for a 'hero' image. If a child page does not have this field filled out I would like to traverse up the structure and find the ...
4
votes
2
answers
483
views
Is there a way to divide an entry's data into multiple subviews with unique URLs?
I have a one-level structure where I am storing a client's projects, with the ability to reorder them by dragging the entries in the structure.
Each project has been designed to have multiple ...
3
votes
1
answer
164
views
How to target Sub-Category of Sub-Category
I have 2 Main Groups of Categories, which themselves have Sub-Categories.
The Categories you see have checkboxes to filter entries below.
One Sub-Group has also Children (With Material/ Without ...
3
votes
1
answer
491
views
Exclude certain entries and its children from navigation
I need to split up a navigaton tree. So I try to exclude certain pages from a structure based navigation tree PLUS their children automatically, but don’t seem to get it.
{% nav page in craft.entries....
3
votes
2
answers
367
views
Output number of children in a structure
In my template I'm displaying all entries of a structure: ('areas').level(1) using a loop.
I would also like to display the number of children entries in each of the 'areas'.
Like: "Area 1, 4 ...
3
votes
1
answer
123
views
Show only children relative to current page
I have this structure section:
1.0 Nav point level 1
1.1 Nav point level 2
1.2 Nav point level 2
1.3 Nav point level 2
2.0 Nav Point level 1
3.0 Nav Point level 1
I want to show only top level ...
3
votes
1
answer
36
views
Remove the anchor in nav loop based on another field conditional
I'm using this solution to output the children within a current structure entry. Unfortunately I need to take out the anchor on some entries that don't yet have content, but still include the (...
3
votes
1
answer
172
views
How do I render specific child entries of a structure based on url segment
For simplicity, I'm building a site for a restaurant. The "Menu" page has the following url(s):
mysite.com/food/appetizers
mysite.com/food/sandwiches
food is a structure. It contains every entree ...
2
votes
4
answers
1k
views
Structure Entry Item's Parent
I need to create a hierarchy that looks something to the effect of
parent 1
parent 1 child 1
parent 1 child 2
parent 1 child 3
parent 2
parent 2 child 1
parent 2 child 2
parent 2 child 3
and so ...
2
votes
2
answers
3k
views
Show parent and it's children as a nav
Newbie here with hopefully a simple question...
I have a structure as per the image below where I want to only show the parent item and it's children on their pages.
I want to exclude the other ...
2
votes
1
answer
554
views
How to search children with relatedTo param
My templates that referenced entry.children or entry.getChildren() have started throwing deprecation notices:
Calling getChildren() to fetch an element’s target relations has been deprecated. Use ...
2
votes
2
answers
644
views
How do I hide children of a disabled parent in a nav?
So I've got a {% nav %} I'm trying to create with the following code:
{% nav page in craft.entries.section('pages') %}
<li>
<a href="{{ page.url }}">{{ page.title }}</a>
...
2
votes
1
answer
2k
views
How to manage different templates for a structure
i am trying to figure out the right way to display elements on a page.
Its about a website for a fashion designer. There will be parent elements like :
Parent X
Parent Y
both of those elements use ...
2
votes
1
answer
2k
views
Craft CMS Structure: How can I display parent and child items on an active parent page?
I'm currently setting up a Structure nav and am trying to set it up so that child pages only display if;
1) The child page itself (or it's sibling) is currently active
2) The parent page of that ...
2
votes
1
answer
1k
views
Eager-Loading child elements in a multi-level structure section
I have a structure that looks like this:
Experiment ( Level 1)
Cages (Level 2)
Animals (Level 3)
Measurement (Level 4)
I am outputting this information into some inline JSON like so:
{% set mice =...
2
votes
1
answer
850
views
How can I get an entry's child category, and not the parent category?
I have a category page that lists all of the entries related to that category. And then I want to display the selected child category for the entry... in brief like so:
Entry Title 1
Entry 1's Child-...
2
votes
1
answer
4k
views
Get children of specific parent
This one seems deceptively simple, but I am struggling. My home page is a single, and in that template I want to retrieve the children of a specific entry in a structure, then loop through them. ...
2
votes
1
answer
205
views
Monthly Calendar || Month View
So I have /calendar and linking previous/next months on that template. The previous/next month urls are /calendar/2015-08 and /calendar/2015-08.
I have this custom route setup:
On my /calendar/2015-...
2
votes
1
answer
1k
views
How can I display second level children only from a specific parent structure item?
I'm trying to display a list of child structure links, but only from a specific parent. The template I'm working on isn't for the parent in question so I don't think I can use 'entry.'
My structure ...
2
votes
1
answer
271
views
Get category children
I would like to select just the children of any given main category (eg. Accessories, Stomps in the picture), regardless of segments in my URL.
I've been trying to understand why the code below won't ...
2
votes
1
answer
735
views
How to get first child URL within Craft/Twig Nav tags
I have a navigation structure as follows:
{% set page = entry ?? category ?? null %}
<ul class="nav menu--main">
{% nav entry in entries %}
<li class="menu__item{% if page and ...
2
votes
1
answer
88
views
Is there a way to prevent uploading assets into a parent level folder?
Say that I have a folder structure like this:
/images
/products
/employee-photos
/user-photos
/advertising
Is there a way that I could define the single asset source of /images while only ...
1
vote
2
answers
3k
views
Check if child entries exists
I'm pulling in entries which are the descendant of the current entry id.
This is an example of my structure: Your Adventure > Honeymoon > A trip entry.
The below code is being used on the Honeymoon ...
1
vote
2
answers
280
views
Complex Navigation
I need to output different HTML for children of navigation. When i use
{% set entries = craft.entries.section('pages') %}
<ul id="nav">
{% nav entry in entries %}
<li class="...
1
vote
1
answer
2k
views
Show only children of current page in submenu
I have checked the official documentation and also these pages:
How do you only show children of "active" parent in a Structure section's nav?
How to output a structure sub-navigation ...
1
vote
2
answers
392
views
How can I create a family tree hierarchy in Craft?
I'm struggling to think of a way to create a family tree hierarchy in Craft.
I've tried using categories and structures, but run into the problem of needing child nodes to have two parent nodes.
I....
1
vote
3
answers
212
views
Newly added child entries not showing on listing/parent page straight away
I am running into an odd issue where creating new child entries does not bust the cache of the parent page(s) that lists them.
This is the structure I am working with:
I am displaying the Course ...
1
vote
1
answer
771
views
How do I get different URL Format with parent/child structures & how do I display different templates?
I need to create a features structure section for a website that will have parent features and child features.
Q1: How do I get different URL Format for parent & child pages?
I need the parent ...
1
vote
1
answer
15
views
Asset has a child category but only displays the parent on templates
I have an asset volume that has a category field. The category field has no max level so I can have parent/child categories.
If I set a child category to the asset in /admin then all is well, but when ...
1
vote
2
answers
520
views
How do I create a structure side navigation that will show active parent list-item and active child list-item
A bit of a background on the project. I have a features structure section, that has 2 levels: Parent features & Child features.
{% set features = craft.entries.section('features').all() %}
My ...
1
vote
1
answer
237
views
Showing/Hiding children of a Structure based on categories
I'm a newbie, so please excuse this if its a super simple question. I have a structure set up like so:
• Parent Section 1
- Child 1A (category: pro-users)
- Child 1B (category: pro-users)
- ...
1
vote
1
answer
556
views
Current Entry Children Count
Does anyone know if I can output the number of children the current entry (structure) has?
1
vote
1
answer
55
views
Delete Parent and Children via the frontend
I'm having some trouble solving this issue and could do it with some help. Basically, I'm looking to replicate the "Delete (with descendants)" function from the admin panel in a front-end ...
1
vote
1
answer
55
views
Change the URL of nav child entry conditionally
I want to change the URL of a li from a nav menu conditionally (using a custom field where the user sets the URL), but I don't see how to use conditionals with {% ifchildren %}?
{% nav entry in ...
1
vote
1
answer
519
views
Counting included child blocks in the Neo plugin
In the Neo plugin, I've made a block that has the option to add 3 child blocks underneath it.
This is the code from the parent block:
{% extends 'neo/default' %}
{% block blockContent %}
<...
1
vote
1
answer
728
views
List both parent entry and its child entry
I am trying to display a list of entries. Specifically the parent entry and it's children's entry.
I started off using this:
{% nav page in craft.entries.section('forms').isChildOf.slug('applicant-...
1
vote
1
answer
681
views
How to list an entries selected nested categories?
I have a entry field populated by categories. The number of categories an entry can have is unlimited and the categories are set up as nested categories i.e.
first level
---second level
------third ...
0
votes
1
answer
50
views
Craft 2, child dropdown, database
I am running Craft 2 CMS for one website. Its in Norwegian for our client.
Its about SKI School. Where Parents reserves sport dates for there children. In database there are parents profile with ...
0
votes
1
answer
76
views
Display children's order numbers
I thought this was going to be easy; showing the order number of children against their parent, but the only answer I can find is in this thread
and I'm unsure how to implement this into my code.
{%...
0
votes
0
answers
144
views
Structure entry connected to multiple parent entries
Is there a way to connect one structure entry to multiple structure entries?
Like:
(wonderfully drawn image represents the connection of Food Festival to both structure entries)