8
votes
Accepted
Entry Form - Multiple Entries & Entry Type & Parent
A little bit late but here it is.
Go to https://pluginfactory.io/ and create a plugin, you need at least 1 Controller but you can leave the Name value blank to create a controller with the same Name ...
4
votes
Accepted
How to manage different templates for a structure
Your approach looks good to me. There are different ways you can make it happen:
If you set up your structure in the CP you can decide how many levels you want to allow for that structure. (By ...
4
votes
Accepted
How can I display second level children only from a specific parent structure item?
yes you can!
You may search for a slug craft.entries.slug('slug-of-first-parent'), select the first result .one(), and then the children by .getChildren(). Now you can proceed as you already did and ...
3
votes
How can I create a family tree hierarchy in Craft?
I can't think of an easy and clean way to visualize this kind of structure in a default list. So if you want to be able to display the structure from your diagram dynamically you'll have much work to ...
3
votes
Accepted
Parent are not set anymore after saveElement()
You need to use newParentId:
$navigationItem = new Entry();
$navigationItem->typeId = 4;
$navigationItem->sectionId = $navigationSection->id;
$navigationItem->title = $entry->title;
$...
3
votes
Accepted
How do I create a structure side navigation that will show active parent list-item and active child list-item
After a long search and lots of trial and error, I've found the perfect solution!
This is how I created a dynamic structure navigation : parent/child (2 levels deep) with class="active" on the parent ...
3
votes
Accepted
How do I get different URL Format with parent/child structures & how do I display different templates?
To get different URL Format for parent & child pages, you need to go to the CP structure settings and edit the Entry URI Format. This is how your URI should look like:
{% if level == 1 %}features/...
2
votes
Structure Entry Item's Parent
For very simple use cases, I've created a plugin that adds some validation to enforce this type of hierarchy: https://github.com/jordanlev/craft-EnforceDualHierarchy
If you'd like to see better / ...
2
votes
How do I remove segment 1 in my URL AND get the parent URI?
Edit your section‘s settings (Settings > Sections > [Section Name]), and delete the static/ from the Entry URI Format.
2
votes
Getting ancestors for manually set parent in template
After much help and direction form @RobinSchambach (much appreciated). I have resolved this as follows;
{% set currentPage = craft.entries.section('pages').slug('archive').first() %}
{% set ...
2
votes
Getting ancestors for manually set parent in template
As @Robin Schambach said, you need to loop through the ancestors.
{% set parent = craft.entries.section('pages').slug('phone-directory') %}
{% for ancestor in parent.getAncestors() %}
{{ ancestor....
1
vote
Accepted
How would you show a specific entry 'and' its children
Try merging like this
{% set parent = craft.entries.section('pages').id(8) %}
{% set entries = craft.entries.section('pages').descendantOf(8).limit(1) %}
{% set entries = parent|merge(entries) %}
{...
1
vote
How can I create a family tree hierarchy in Craft?
Create a regular channel where the entries have a relationship to the parent and not the child.
That means that each child can have any number of parents and each parent can be related to as many ...
1
vote
List both parent entry and its child entry
This is the corrected Twig code. I simply added {{ entry.title }} as an <li> item. This nav appears only on the page that I needed entry.title displaying.
{% set navList = (entry.level == 2) ? ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
parents × 17structure × 13
children × 10
entries × 4
templating × 2
entry × 2
navigation × 2
craft3 × 1
url × 1
sections × 1
events × 1
fieldtypes × 1
entries-field × 1
entry-type × 1
saveentry × 1
segments × 1
entry-form × 1
calendar × 1
craft.entries × 1