Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [categories]

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

Filter by
Sorted by
Tagged with
11
votes
2answers
3k 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 ...
9
votes
1answer
4k views

Users relatedTo multiple categories

Trying to get users in a members group related to multiple categories. {% set services = craft.categories.group('services').slug('service-1, service-2') %} {% set locations = craft.categories.group('...
8
votes
1answer
2k views

How do I add a subcategory to the URL slug for a channel entry?

I'm trying to mimic the URL structure exactly how I have it in my old CMS. If I select an entry to have both a category and subcategory I would like to have the subcategory in the URL along with the ...
4
votes
1answer
464 views

Assign Category via Guest Entry Form

Is is possible to assign a category via a frontend Guest Entry form. I tried <input type="hidden" name="fieldHandle" value="SomeExistingCategorySlug"> But that did not work.
8
votes
1answer
1k views

Building a simple search by multiple categories

Is it possible to build the following/is it the right way in Craft. Been through the docs and searched but stuck. I just need to build a form on one page with a dropdown select for 2 categories; ...
12
votes
2answers
1k views

How to find entries with no category

I have a field categories in a channel news, and I want to find all the entries in news that don't have a category set. I know I could loop over the entries and find them that way, but I'm hoping to ...
5
votes
2answers
3k views

Order entries by category field

I'm loading a set of entries related to 'category' and ordering them by the value of a Dropdown field in the entries. This work well using this code: {% set entries = craft.entries.relatedTo(category)...
5
votes
2answers
586 views

Categories field is losing its value when programmatically updating other fields’ values

I have a webhook that fetches an entry, modifies one of its custom Text field values and then saves the entry. However there is also a required Categories field on the entry, and when I do this, I get ...
4
votes
1answer
601 views

How can I output a list of categories that are not empty?

In other words, categories must have at least one enabled entry assigned to them.
4
votes
1answer
253 views

Getting entries related to all of supplied categories, if they exist

I'm trying to get all entries that related to one .. three categories, as determined whether their id appears in the query string: {% set sector = craft.categories.id(craft.request.getQuery('sector'))...
11
votes
2answers
3k views

Advanced Search

Not sure of the best way to progress with this but i'm trying to create an advanced search on a Craft site. What it needs is a select dropdown for Authors, Categories and a normal text input. The ...
13
votes
2answers
1k views

Difference between categories and structures

The recent updates to categories have been great and provide a lot of flexibility. But now I find myself struggling to decide what should be a category group and what should be a structure. For ...
7
votes
1answer
810 views

How to get entries related to current category only (not children)

I need to get entries which are only in current category, not child categories. So if I have a category structured like this: Food ----Fruit -------Apples -------Bananas I've got a categories ...
2
votes
1answer
3k views

Get entries which have a certain category assigned to them

So, i have a channel called images and a couple of category groups one of which is called "images" which has categories called family, animals, individuals in it. So, i just want to grab the entries ...
1
vote
1answer
640 views

Linking to Search Results

Ok what i'm trying to achieve is a set of links which have "search parameters" attached to them. Which would be a "category" and an "option.field". Then when these links are clicked they display ...
1
vote
1answer
377 views

Find entries that have a category selected from a category field within a matrix block

I've got a Section that uses a Matrix field, that has a block, that has a categories field in it. I want to find all entries using this Matrix field, who has a categories field and has a certain ...
4
votes
1answer
2k views

Listing categories alphabetically & total post count

How do I list all categories in use alphabetically? And how to get the total post count from each category? Cheers
4
votes
1answer
1k views

Product Categories, Structures and Channels

We are currently updating a brochure website, separating a single list of products into a series of sub-categories. Currently, we have a "single" section to display all products, and then a "channel" ...
2
votes
0answers
304 views

Searching for Multiple Categories and Tags

I've been pulling my head for the past day on how to filter products with multiple categories. After a long search, I found and implemented on my project, Advanced Search with tags and categories It ...
6
votes
1answer
617 views

Custom Category order in a Categories Field

I have a load of projects, each of which can have zero or more categories which indicate the particular type(s) of work involved. As well as using these categories to produce a 'category page' of ...
2
votes
1answer
846 views

Category as select dropdown box

Im trying to setup a front end user form with a category as a select box. The box looks right but when i submit the form i get a new entry and other fields are filled out but the catgory fields are ...
2
votes
1answer
1k views

ElementAPI handling CategoryModel and returning a heirachical object

Currently involved with handling the CategoryModel and using this code return [ 'endpoints' => [ // Category 'category/<slug:{slug}>.json' => function($slug) { ...
0
votes
1answer
296 views

Categories Related To Matrix Fields

Please help me build my sandwich locator maker :) I have 3 categories, breads, meats, condiments I have a Section called subShops with a matrix field. My matrix field is called sandwichBuilder, ...
17
votes
1answer
6k views

How do you list categories in a category group?

I would like to output a list of all the categories in a category group on the front end. How do I do that?
3
votes
3answers
2k views

Filter entries by multiple categories

I am trying to set up a form with checkboxes that allows users to filter entries by selecting multiple categories, but I am not quite getting it right. Currently this is my form: {% set ...
7
votes
2answers
1k views

Listing categories with post count in a nav?

I'm trying to list my categories (and sub categories, just one sub level) as a nav, and have the number of entries in each of those categories beside each one. There is another question on here which ...
10
votes
1answer
1k views

Check to see if category is populated?

I want to list all categories that have an entry assigned to them, but hide the ones that are empty. In EE I could do this show_empty="no" But I can't see a parameter in the docs for Craft. ...
4
votes
2answers
678 views

How to query with relatedTo of a Relationship Field in a Matrix Field block

I have structures called Instrument and Person. On the person structure, I have a Matrix field called Roles. Roles has a block called Musician. And That block type has a Relationship Field called ...
4
votes
1answer
573 views

Craft 3 Multi Category and Field Search

Looking for the solution to searching entries in one section that are related to multiple categories and match number field criteria. This is for a used auto website. Categories: Make/Model/Trim: ...
4
votes
2answers
1k views

Best way to programmatically create categories?

We're working on an XML import plugin to migrate content from another CMS. What's the best way to create a new category (with a name, slug etc.) and assign it to the entry when running $entryModel = ...
3
votes
1answer
4k views

Craft entries related on a category page

So i'm trying to output blog entries related to a category. I first created a category group ('categories') I added several categories to the group ('innovation', 'teams', etc) I added a category ...
2
votes
2answers
2k views

How do you only show children of “active” parent using categories?

I'm currently using Categories to organize an inventory of products. The hierarchy is straightforward: category, subcategory, and single product entry. The url structure I'm are hoping to use reflects ...
2
votes
1answer
897 views

How to filter entries in multiple category groups by selecting multiple categories

This question is very similar to the question posted here I have asked in the comments but my requirements are slightly different. I am trying to filter search results by categories in more than one ...
8
votes
2answers
477 views

Is there any way of specifying a default category for a category field?

I've set up a channel using categories to distinguish between different blog post types. The majority will probably be in one category, so it would be great to be able to specify a default category. ...
4
votes
1answer
748 views

Saving Entry with Category field

I am stuck on saving entry with a category field. The error message I get is about not being able to create/update the entry in the relations table. $accomodationTypecategory = ['title'=>'Hotel'] ...
3
votes
1answer
714 views

Are categories the best way to organize Commerce product filters?

The Commerce site I'm working on (my first Craft project) will have a product listing page with filters. These will function as you would expect, but clicking a filter name will link to another ...
3
votes
1answer
804 views

How do I output entries by their category?

Ok, so basically I want to loop through categories and output the title of each category along with all the associated entries. Like so: Category 1: Entry 1 Title, Entry 3 Title Category 2: Entry 2 ...
2
votes
1answer
955 views

Display Category Group Name in Template

Having a bear of a time doing something which seems like it should be quite simple. I'm trying to display the category group name in my templates, using the handle and can't quite get it. I've ...
2
votes
1answer
377 views

Multiple categories filter

I have a channel section called Members. I have 2 category groups (categoriesMembres & cantons). My goal: show entries only related to a specific category in categoriesMembres and loop through ...
1
vote
1answer
377 views

Show all tags related to a category?

Is it possible to show all tags that are related to a category? I can't find anything on it. Thanks. Edit: What I am looking for is this: I know a category slug or name. I want to get all tags ...
1
vote
1answer
563 views

Is it possible to have category listing page of entries if the category is defined within a matrix block inside said entries?

I think I have been staring at this problems too long and I need a kick in the right direction... Here is what I have (the content modeling is a tad wonky but this is what we're dealing with): ...
7
votes
1answer
726 views

Filtering/searching for entries by category in the control panel

Is there any way of filtering by category in the control panel entries list? Likewise, is there for an "entries" field (like how Playa lets you filter by channel, category)?
5
votes
1answer
851 views

Display category entries based on Segment?

I'm really struggling to display entries of a category, based on the segment. In other words, I have 1 category template, so the category needs to be determined dynamically (*we still do this by ...
4
votes
2answers
783 views

Is it possible to limit users to adding/editing entries in specific categories?

I'm building a site that regroups several properties, and I'd like each manager to edit content in his property only. All properties use the same templates and share content between each other. I ...
4
votes
1answer
1k views

How to display the title of a category based on its ID?

I’m passing the ID of a category to a template via a catId query string (i.e. http://example.com/some/path?catId=10). How do I display the title of that category?
2
votes
2answers
305 views

Sharing a template with identical category and tag name

I'm trying to stay as DRY as possible here and sharing one template for a news list view; all, category and tag all sharing the same template (and trying to refrain from having a category or tag ...
2
votes
1answer
751 views

Tie two select fields together based on category and subcategory?

I'm trying to set up a front end form where the user can choose their city and state, which are stored as categories. I have states set up as the parent category and individual cities as sub ...
2
votes
1answer
479 views

Craft Commerce Categories and Product Types

I've just started using craft Commerce. What's the accepted way to categorise products? For example, i’m trying to replicate this structure: Bags and Scarves (shows all products in this category) ...
2
votes
1answer
941 views

Display entries by category (multiple categories)

I would like to know how I can create a page that contains all entries from a section e.g. 'news'. I want to divide the entries by their given category. News (section) Category 1: entry in ...
2
votes
2answers
117 views

Only fetch categories that are related to a minimum of entries

Is there a way to only fetch categories that have been assigned to a minimum of entries, i.e. 4? Currently I fetch categories like this: {% set productIds = craft.entries.section('products').ids() %}...