Questions tagged [categories]
Categories are taxonomies for your entries, users, and assets.
519
questions
1
vote
1
answer
23
views
Entry URI Format from an Entries Field (Categories)
i am trying to set the url format for some entries to include the category slugs set for it within a category entry field - i can get the first one like this
{eventCategory.one().slug}/{slug}
but ...
1
vote
1
answer
46
views
Only show entries related to child category if it exists
I have a categories field for outputting products to a map. The categories linked to that field have a parent/child relationship.
With {% set products = craft.entries.section('products').relatedTo(...
1
vote
1
answer
61
views
Twig Runtime Error on Craft 4 Getting Started Tutorial
I'm working through the 'getting started' tutorial and I've run into an error I can't get passed. I've created the Category Group: 'Topics' and then created the Field 'PostCategories' and connected it ...
1
vote
1
answer
54
views
Check if eager-loaded category exists on product
On my craft commerce project i eager-load categories which belong to a prodcut.
in my product template i do for eager -loading:
{% do craft.app.elements.eagerLoadElements(
className(product),
[...
0
votes
0
answers
37
views
How to list categories only related to enabled entries or disabled child entries
Edit: solved in comments
My entries are set up as a parent > child structure. A single entry can either have children or not have any. If parent has children, the children entries are put in a ...
0
votes
0
answers
30
views
Matching entries against category custom field
I have two channels, pages and products and category groups for categories and regions.
The pages entry type has a field where you can select entries from products based on their category and region.
...
1
vote
1
answer
32
views
How to group assets by category/sub-category
I have a section called “products” that has an asset field called “product-docs”. The assets are pdf files that have a Category field. Each product can have many different types of documents; to make ...
1
vote
1
answer
63
views
Batch retrieve the entry count per category item in facet filter
I'm building a facet filter using Craft Commerce products and Craft categories. I have a "Brand" category and each product entry has a brand defined. Same for the other facet filters that ...
2
votes
1
answer
28
views
How to display a category on the site?
Please help me to display the categories. I have a category group with a huge category tree. Can I somehow output not the whole group of categories, but only a certain category with its child ...
1
vote
1
answer
21
views
How to display the final/child category of an entry, not parent category as default
I have the following categories
Tech (1 entry: case A)
1.1 Apps
1.2 Software (2 entries: case B)
Fashion
2.1 Clothing (1 entry: case C)
2.2 Shoes
...
When using {{ entry.categories.one().url }}, it ...
1
vote
1
answer
155
views
How to filter a categories query
I have a categories group named "Title" in my backend. In that group I have 15 categories, but I want to display only 3 specific categories on the frontend. How can I filter my query and ...
0
votes
0
answers
28
views
How to append the category field data nested inside a section to an input tag?
while clicking the input tag it should display its related entries
Based on the category field the data selected in the backend value should get appended to the input tag.
When looping through the ...
1
vote
1
answer
19
views
Is there a way to mutate categories through GraphQL for a specific siteId?
The graphQL does not support siteId parameter in category mutation. How could I mutate the content for a specific siteId?
1
vote
1
answer
128
views
How to programmatically create category groups and categories in Craft 3/4
I am struggling to create a new category group and category programmatically. I've found a few examples for creating an entry, and one for creating categories in Craft 2, but I can't get it working in ...
1
vote
1
answer
176
views
GraphQL - Optional relatedTo value
I have a component which lists events and can be configured to filter by category.
Query:
query Events($filter: [String]) {
entries(
section: "event"
relatedToCategories: {group: &...
1
vote
0
answers
55
views
Updated to Craft CMS 4.2.5 and now the "New Category" button is missing in Control Panel [closed]
Like the title says. I've just updated to the latest version while building out a new site in Craft CMS and the New Category button is missing from the Categories screen in the CP. Both when you go to ...
2
votes
2
answers
165
views
Convert Categories into Structure entries
We chose to create a set of content on our site as a category group. We're starting to port over content from our old site (Drupal) and have realized a few bummers — the main one being no revision ...
0
votes
2
answers
265
views
Nested categories URI format on entries
I have a Category Group that can be 3 levels deep. Each category has its own page and its URI structure appends each category as you go deeper, like so:
{parent ? parent.uri : 'root-uri' }/{slug}
...
1
vote
1
answer
62
views
Entries field within structure
Not sure whether it's a bug or the correct behavior. How do I see the parent category just like the categories do?
Entries field related to the category group (another project)
0
votes
1
answer
433
views
GraphQL - Categories with entries
Is it possible to get categories with related entries with one graphQL query?
I have the following query:
query MyQuery {
categories(relatedToEntries: {section: "entryType"}) {
id
...
1
vote
1
answer
119
views
How do you Eager Load Category Fields with Pagination
I have two category fields, teamCategory and articleCategories, on a news listing page that I'm trying to eager load. Problem is, when I add the eager loading it no longer outputs the categories. I ...
3
votes
1
answer
467
views
Eager loading categories and assets inside related entries for gallery
I am looking for some advice on how to best streamline a gallery system on a site, but having trouble wrapping my head around the syntax needed to eager load nested asset fields with categories inside ...
1
vote
2
answers
152
views
Feed-me import nested categories from CSV/Google sheets
I'm currently able to import nested categories from a Google Sheets when they already exist.
But when a child category does not exist, the category is created at the first level. It's quite logic ...
1
vote
1
answer
39
views
Events with Speaker: Categories or Channel
Sorry for this general question, i am building a large archive site with many (>1000) Events. Every Event has one or more Speaker. At the moment I am using two channels: "events" and &...
1
vote
2
answers
150
views
Hiding categories in real time with Sprig in a faceted search
I've built three buttons with checkbox dropdowns that display categories that filter the content below based on categories. I am currently using the relatedTo function to only display the categories ...
1
vote
1
answer
49
views
Bad Gateway when using cached category query
I'm trying to find all tiers that have associated entries for a selection dropdown.
This does not work, and throws a 502 error
{% set allTeirs = craft.categories.group('catPartnerTeirs') %}
{% set ...
1
vote
1
answer
56
views
Find First Entry That Matches Current Category
I need help. I am creating a category listing which I have working great. The next step is where I'm struggling a bit as I can't seem to query the related entries on a loop basis.
For each "...
1
vote
2
answers
148
views
What is the best way to create breadcrumbs based on a categories?
I have a question related to breadcrumbs. I have a multiple categories with level 3 hierarchy, now if I assign only one category to any product it works for me to create the breadcrumbs based on the ...
1
vote
1
answer
31
views
Assign category to entry using a plugin
Feel like I'm going crazy here...
I've got this snippet of code.
I find my entry based on title key/value.
I find my category ids based on alcohol key/value.
I attempt to set the entry category ...
1
vote
1
answer
86
views
Are categories first class citizens compared to tags?
I understand the difference between categories and tags. I am trying to choose between them as my taxonomy is not very deep and tags seem just as good as categories. But it occurs to me that ...
1
vote
1
answer
27
views
Error when clicking on a category in admin (related to SEOMatic?)
I get the atatched error when clicking in the admin of my site - it seems to be related to SEO Matic but not sure?
Anybody any idea?
Many thanks
Malcolm
1
vote
0
answers
45
views
GraphQL API query to load all related data
How to write a query to load entries with its category or any other related data.
For example I have cars that related to the BMW category.
How I can access the category data in the query that fetch ...
1
vote
1
answer
365
views
Filter entries based multiple category groups
This is related with Split categories by levels / List categories merged by name which I explain more on detail there, after that I take the suggestion of create separate category groups, so:
I have ...
1
vote
1
answer
95
views
Everything comes null when I try to filter entries by category - Craftcms 3
There's an issue when I filtering by categories but everything comes null, I was debugging code but all the entries has the same problem! But I don't know why does this happens? The entry comes well ...
0
votes
0
answers
88
views
Split categories by levels / List categories merged by name
I have a scenario where I need category levels (4 levels) split in different sections of the page, also some categories have the same name, I explain:
I need to list entries based on a category group ...
1
vote
1
answer
763
views
Element API: Get Entries Related to Category with Query Parameter
I'm using the Element API Plugin to create an API, with which I want to get entries related to one category, but dynamically with the category set in the Url.
What I have so far in the config/element-...
1
vote
1
answer
52
views
Use same handle for different fields on different entry types
I've got two entry types: blog and job. Each has a category field but different category groups: blogCategories and jobCategories. I would like to write a Twig include to accept either a blog or a job ...
1
vote
2
answers
92
views
Count number of consecutive years in category array
I need to count the number of consecutive years a user has been a member of our organization. For example, if they've been a member from in 2018, 2019, 2020 and 2021, their loyalty will be 4 years.
If ...
2
votes
2
answers
131
views
Order entries by related "Year" category and paginate?
I have a section called Library, and a category group called libraryYears. The categories in that group are just years (2021, 2020, 2019...)
Each entry in the Library is related to a year in the ...
1
vote
1
answer
51
views
Adding Categories navigation to show certain entries
I'm abit lost as to how to structure my FAQ page.
I have a single FAQ page that pulls in every FAQ post, these posts come from the FAQ Entries channel.
But
On the single FAQ page, how do I add a ...
1
vote
1
answer
76
views
How to search for Entries that have a particular Category set within a Matrix field in the Control Panel?
I have an arrangement like this:
Entry type 'people'
└ Matrix field 'offices'
└ Block type 'office'
└ Category field 'building'
On the Entries screen, how can I search for people that have a ...
1
vote
1
answer
61
views
Get the Sub-Category Link from Category field in a Structure (output with Nav tag)
I am creating a Structure for the main navigation that has two possible choices for the Link: Entries field or a Categories field. The answer I received here showed me how to setup the basics but if ...
0
votes
0
answers
53
views
How do you Paginate if Looping through element queries directly is deprecated?
I want to create a basic product listing page based on categories. I created a template that dynamically shows all items based on the category that is passed to it based on the help I received here. ...
0
votes
1
answer
111
views
Paginate based on items in a Category
I'm trying to wrap my head around Pagination in Craft. I have a template that outputs a list of products based on the Category that is passed to it from this thread:
{# Fetch the entries related to ...
0
votes
0
answers
62
views
How to get a specific category by index
I have 4 level product categories. For the menu I am building I need to pick a second category in all top level categories
So I get top level categories like so
{% set lv1Categories = craft....
1
vote
1
answer
283
views
Simple Product Listing Pages by Category Slug
I'm new to Craft and I'm trying to create very basic product listing pages based on Categories and I'm not sure where to start.
First, it doesn't look to me like you can create separate templates for ...
0
votes
0
answers
37
views
Get categories with number of hits (entries, products)
Is there a way to get a list of categories with the number of entries associated with each particular category?
I want to output something like this:
It would make sense to fetch the number of hits ...
1
vote
1
answer
233
views
Match to Existing Category on FeedMe Entry Import JSON
I've successfully exported product entries out of an ancient version of ExpressionEngine (1.7.1) into a JSON file and for the most part I've successfully imported that JSON using FeedMe—except for two ...
1
vote
1
answer
707
views
How to use Sprig's "Load More" Recipe After Update
This is a continuation of a previous question I had (Here). I am using Sprig's Load More Recipe. In my category page, I want the load more function to only pull up entries that equals the current ...
1
vote
1
answer
66
views
Display related entries on a category page filtered by another category field
I have a Structure called "Stoves".
Each Entry has two Category fields 'fuelType' and 'output'.
Fuel Type categories = ''Wood Burning','Multi-Fuel','Gas' and 'Electric'.
Output categories = ...