2

The error tells you that faqs is null. As you're using the first() function to execute your element query, this means that your query has no matches. Are you sure that the section handle (FAQ) is in uppercase? The correct way to create an entry query in Craft 3 is craft.entries(). Although it may work without the parenthesis, it can't hurt to add them. You ...


1

I found a solution: {% include "_private/partials/matrix" with {blocks: entry.bodyContent.typeId(null).all()} %} This fetches all Matrixobjects from any type. So it works now. But I don't undestand, why this is necessary. Maybe its because I used for my first project this Blogstarter. Maybe there are some relicts from craft2 inside. So I have the ...


1

Without seeing the code of your template _private/partials/matrix it's not easy to help you. Maybe you need to check the block type first. I usually do that with a switch and have a different partial for each block. So your template _private/partials/matrix could look something like this: {% for block in blocks %} {% switch block.type %} {% case "...


1

For grouping arrays, use Craft's group filter or index filter, then for joining the array items with commas use Twig's join filter. Something like this might be what you're looking for (I've also added eager loading for improved performance, and I used the map filter as a cleaner way of organising the array, though you could use a nested loop if you find it ...


1

By the way, is your Craft CMS version 3.x? If so, using "one" is recommended instead of "first", which is deprecated.


1

Is the "Assets in this volume have public URLs" turned on?


1

This isn't really a Craft question. Craft is simply responsible for outputting the requested data into your template, and you can use whatever you'd like on the front end to display it. What you want in this case is a JavaScript carousel or slider. You can build your own, or use a simple library. I like Flickity and use it often, but if you just do a Google ...


1

Here's how I would approach this... {% set classBlocks = entry.classBlocks.all() %} {% if classBlocks | length %} {% set instructors = classBlocks | filter(block => block.type == 'instructors') %} by <strong>{{ instructors | map(instructor => instructor.fullName) | join(', ', ', and ') }}</strong> {% endif %} We're using several ...


1

Seems like a huge hack to me but here's how to do it: {# Split paragraphs using with a limit of 3 #} {% set paragraphs = text|split('</p>', 3) %} {# Get an array containing the first 2 paragraphs, and convert it back to a string, adding missing closing tags #} {% set firstParagraphs = paragraphs|slice(0, -1)|join('</p>') ~ '</p>' %} {{ ...


1

This was a separate issue causing this, the above works fine.


1

My site is localized, so I ended up doing... {% if craft.app.request.url == '/' or craft.app.request.url == '/' ~ craft.app.language %}


1

I had the same problem and I found out - it is necessary to create a route. You have two options for that: Entry (single) with slug Custom Route Thats because redirectInput() redirect to an url. But without a route - you just can not access the template tree. Thats the whole point of a routing system. I would love to see a custom route created (and ...


Only top voted, non community-wiki answers of a minimum length are eligible