Questions tagged [categories]

Categories are taxonomies for your entries, users, and assets.

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

Showing Reverse Relationships in CP | Products < > Categories

My clients would like to be able to see what products (Artworks) are added to a category (Collection), and vice versa in the CP. Relating on the front end is fine, but on the backend there seems like ...
0
votes
0answers
19 views

Is it possible to get a users most popular categories based on Craft products?

So i wanna show the user the product categories that is most popular for that spesific user. Is that possible?
0
votes
1answer
33 views

if statement in a template not working

I am making a condition to use a certain template for a specific article category, but it's not working and giving me an error. {% extends "_layout" %} {% set title = category.title %} {% block ...
1
vote
1answer
28 views

How to create a category filter for a portfolio site?

I want to create a category filter similar to this website http://www.mypoorbrain.com/ (just a random website i found with the desired effect). Basically I want the categories to be displayed ...
0
votes
0answers
13 views

Convert a channel to a category group

Is it possible to convert a channel to a category group retaining all the old entries as categories. My guess is I'll need to write a plugin.
1
vote
2answers
199 views

Switch entry type based on the category

I'm trying to use different entry types for certain categories. My category group is called categories, and the slug for Features is features. I have the category group pointed to categories/_entry. ...
0
votes
0answers
16 views

Apply search filter in Element API

I have managed to build the search filter structure at the twig, but I get stuck when try to convert this structure in element API, {% if craft.request.getParam('query') %} {% set keyword = craft....
1
vote
1answer
9 views

Matrix-field with a category-field to output category-title on single entry page

Me and categories, always giving trouble :) On blogs, we are using a matrix field and in one of the matrix-types, I have a category field. This is to output the title of the category. {% extends "...
2
votes
2answers
14 views

{{ category.title }} error with category groups

I feel like I'm missing something totally obvious here, but how do I output a category name for a category that is part of a category group on a single entry layout? The name of the category group is '...
2
votes
1answer
227 views

Is it possible to create category for only one site in a multisite setup?

If not, how would you best approach this issue? For us, different sites have different categories, and also, not always the same number of categories. At the moment, when we create a category, it ...
2
votes
2answers
292 views

Craft 3 query children of sub categories

Just wondering how to only query the children on subcategories. For example... Food ├── Fruit │ ├── Apples │ ├── Bananas │ └── Oranges └── Vegetables ├── Brussels sprouts ├── Carrots ...
0
votes
0answers
31 views

How to get most used categories by descending order

{# Create a category query with the 'group' parameter #} {% set categoryQuery = craft.categories({ group: 'businessCategories', limit: 6 }) %} {{ dd(categoryQuery) }} I ...
0
votes
0answers
8 views

Is there a way to sync/migrate the entry under category's entry to that entry's category at the entries

The admin had assigned all the entries to a category under the 'Categories' page. But now instead of adding the entry under the 'Categories' page, the admin prefers to add the category under the '...
0
votes
0answers
19 views

Ajax loading for filter based on categories in Craft 3

I have a page with blog listed with pagination using craft paginate. {% paginate craft.entries.section(['blog']).orderBy('postDate desc').limit(15) as pageInfo, entryTemplates %} Now I am need of ...
1
vote
2answers
32 views

Display entries sharing the same nested category on an entry page

I'm trying to show the other entries assigned to the same nested category (on an entry template) but get an error if I use .last() which I was hoping would show the nested category assigned entries (...
1
vote
1answer
31 views

How can I retain entry category filtering on entry pages' pagination

I have a list of entries, with an option to filter them by categories. If no filter is applied, clicking an entry should (and does) take you to the permalink URL for that entry, as defined in the ...
1
vote
3answers
450 views

How can I show the child category and not it's parent - but other times show it's parent?

I have a categories field on an entry that can have one or many children. I am able to output everything - but would like to restrict the field a bit more. If a child has been selected, I do not want ...
1
vote
1answer
78 views

list entries by category, including uncategorized entries

I have a channel that is essentially a list of companies participating in an event. Within that channel is a category group of sponsorship levels. Companies that are sponsors are assigned a ...
2
votes
3answers
971 views

How do I conditionally set active state in category navigation?

Here is the code I am trying to use to set an active state for category navigation: {% for category in categories %} <li {% if craft.request.segment(2) == "{{ category.slug }}" %}class=...
1
vote
1answer
24 views

How to query in MySQL all entries with related categories

I have a custom product grid not associated with Craft Commerce. I am wondering, how can I query, in the SQL database, all entries and their related categories?
1
vote
2answers
2k views

Category vs Tag

Is there a fundamental difference between a Craft Category and a Tag? I originally set up a site using Tags before the Category feature was available and now I'm adding a new section and trying to ...
0
votes
0answers
17 views

Front End get category group from uid

I have a form on the front end which has a category field. I want to display all the options from the category group, by obtaining the categories from the category group. When i dump the properties ...
1
vote
1answer
82 views

Create nested categories with Feed Me plugin

I'm trying to import nested categories. My JSON is like: [{"title":"Title""location":[{"Florida":["Key West"]}]}] I want to be created "Florida" category and nested child "Key West" But plugin ...
2
votes
1answer
37 views

Don't output specific category on entry page

With {% for category in entry.categories.all() %} <a href="{{ category.url }}">{{ category.title }}</a> {{ not loop.last ? '| ' }} {% endfor %} How do I exclude a specific category ...
1
vote
1answer
30 views

order and limit the occurrences of related categories

I'm generating a list of all related categories of the entries listed on the page. {% for entry in entries %} {% set categories = craft.categories.group('functieGroep').level(2).relatedTo(entry)....
1
vote
1answer
53 views

Categories or Structures: Most efficient way to organize FAQ sections

Working on a plan for a site that has multiple audiences, with a FAQ section for each audience. FAQ entries are organized by Topic (Finance, Advertising, Publicity) each FAQ entry can be ...
1
vote
1answer
32 views

Get entries with related to selected categories and then group by category

Background: I have a listing overview page that lists teaching staff grouped by their department (A category group holds all departments). E.g. All Staff Members: -- Science -- Mrs Magnesium ...
0
votes
1answer
28 views

In entry.getPrev/Next navigation, show entries from a specific category only

I have portfolio section that has a ‘portfolio’ category attached to it, which has categories ‘2D’ and ‘3D’. There are 3 templates: The index template shows a list of all the entries in the ...
3
votes
2answers
649 views

Check if Category is in Query

I'm trying to check to see if a particular category (In a loop) exists in a query submitted from a search form. At the moment I'm doing this inside a 'childCategory' loop... {% for childCategory in ...
0
votes
0answers
13 views

Conditionally test for a category level

I want to display different code blocks if a category level is 1 or 2 or 3 – on a category page, but finding this hard to do, if I'm on an entry page I can use: {% if entry.level == 1 %} how can I ...
1
vote
1answer
24 views

Allowing duplicate slugs in category paths

Again, I've had a look online but couldn't figure out what I had to do. Say I've got a category structure like the below: Category 1 Saturday Sunday Category 2 Saturday Sunday How can I allow ...
1
vote
1answer
24 views

How should we be setting up product categories/sub-categories?

New to Craft CMS and currently don't understand the terminology or how things work together in the platform yet. If I want to set up a category structure like the below in Commerce, how is the best ...
2
votes
1answer
38 views

Link to a nested category

I'm using a matrix field to allow the author to add products they can link to category pages, but my code: {% for block in entry.transformerProductNavigation %} <a href="{{ block.transformer.one....
0
votes
0answers
23 views

Filtering entries by category and author channel

I'm setting up a blog on a new site - a few hundred entries have been successfully imported. Now I need to set up front end filtering. Each summary on the listing page has a link to the category ...
1
vote
0answers
26 views

Showing entries in same category, excluding the current entry

I'm new to this, so sorry if this is really basic. I want to display a list of entries in the same category as the main entry in my template, excluding the current entry. This is my code: {% for ...
0
votes
1answer
22 views

Order related entries by number of categories they have in common with current entry

I'm creating a list of similar entries which displays entries that share the same categories as the current entry. My code looks like this: {% set categories = craft.categories.relatedTo(entry) %} {% ...
1
vote
2answers
59 views

Craft Query by Category and Tag

I am trying to find the last four Channel entries (Named: Post) with a Category relatedTo "Support" (id: 458) AND Tag relatedTo: "Widget1" (id: 469) I've had success using Category or Tag but not both:...
11
votes
2answers
4k views

How to filter entries by clicking multiple categories on front end

I would like to be able to filter my entries list by multiple categories on the front end. For example, if I first click a category button "lunge" then the results would show entries which are ...
1
vote
1answer
36 views

What is the best approach for multi categories filtering

I need a solution for a good filter approach in Craft. I used 3 Categories related to an entry (Project). The 3 Categories are (Type / State / Location) How do I have to set up the routes for the ...
1
vote
1answer
16 views

Show Category Title only where an entry has been included in an Entries field

I have a Category Group with an Entries field assigned so the admin can select which existing Entries should fall within a given category. An Entry can be assigned to multiple categories. On the ...
0
votes
0answers
9 views

Output category hierarchy in Element API

I am looking to output categories in a level hierarchical format. I have multiple categories, with different levels of categories. Entries can be related to different levels of those categories. ...
2
votes
2answers
204 views

Craft 3 version - How to get entries related to current category only (not children)

I need some help with syntax on this for Craft 3, please. I want to use this piece of code: {% set fruitEntries = craft.entries.relatedTo({ relatedTo: catP,id: 'and, not '~str }) %} from this ...
0
votes
0answers
21 views

Supertable - Group rows by category field

I'm using the supertable plugin and my rows consist out of 3 fields. One of them is a categorie field (the categorie field only consist out of a title). I want to group all my rows by category so ...
1
vote
2answers
227 views

Filter entries with AJAX

How would I sort blog entries displayed using AJAX? What I want to achieve is initially show all posts from a channel (All) but then let my users sort through these posts with a sub navigation using ...
1
vote
0answers
22 views

Filtering Entries based on Amenities (Category)

Hello and thank you in advance. I have a page that lists hotels by region. On the initial load of the page I am able to render all the hotels by region in a tabbed format. This part of the page works ...
1
vote
1answer
52 views

Show entries by a certain category AND certain lightswitch

Just thinking of an easy way for the user to manage products on a site. Therefore is it possible to display entries by a category and a lightswitch toggle? IE. Category selected is Photocopiers and ...
1
vote
1answer
23 views

List child categories which have entries based on the current categories

I am looking to output the child categories of a parent category. I only need to show the categories which have entries related to them. I have done this to show all categories using {% set entryIds ...
1
vote
0answers
25 views

How to display entries by descendants of a particular category slug

I'm trying to display entries (with a category heading) by only the descendants of a particular category slug. So it would be similar to this: Display entries by category (multiple categories) but ...
1
vote
1answer
33 views

Get entries related to selected category only and not it's ancestors

The following is using commerce product entries, but I'm reasonably sure it could be any entry. With the following category taxonomy: - Category 1 - Category 1A - Category 2 - Category 3 ... If ...
1
vote
1answer
23 views

relatedTo a category in a matrix field

All, I'm very close, but missing something and any help is appreciated. I have a teamMember matrix block allowing me to add employees with some basic info. One of the fields is a category field called ...

1
2 3 4 5
10