We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [categories]

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

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

Setting an Entry field using sum

I'm looking to set a 'score' property on my "category" field, this will be done by calculating how many entries are within that category similar to a 'Trending' feature. Is there any way to set a ...
1
vote
1answer
253 views

cannot get relatedTo by slug only ID

Can someone tell me why I am going crazy and cannot figure this simple relatedTo issue out? So I have a categories section called Case Studies and several categories within. I am trying to filter the ...
1
vote
1answer
175 views

Eager loading fields within categories

Is it possible to eagerLoad fields in categories? I have this code; {% set markets = craft.categories.group({ section: 'markets', with: ['bannerImage'] }) %} which for some reason is throwing ...
1
vote
0answers
115 views

Order Entries by Category Fields (with fallback)

This is almost a duplicate of this question I have a section which I want to sort by category field. But the categories are not mandatory. When I apply |group('refSorter.first().title') it will ...
1
vote
1answer
176 views

How are parent and child categories related in Craft database?

I am writing an API which directly connects to Craft database and retrieves data. I need to get the categories hierarchy. But I can not find how parent and child categories are related in the ...
0
votes
0answers
181 views

Get Entries from Section related to a category

I'm currently trying to get all entries which belong to a section which is related to that category. e.g. Category Brand Offer Offer belongs to a brand. Brand has a category field. {% set ...
1
vote
1answer
85 views

Ajax - How to create a Category through actionTrigger

I'm trying to create a jQuery/Ajax script to import data from a Wordpress API service and want to import the WP categories and tags into my database. I've managed to import the tags using an Ajax call ...
1
vote
0answers
96 views

Structure parent root - entry type or category urls?

Been rolling around with this for the last 36hrs trying to decide most useful option. The dilemma is how to preserve a structure and use categories - or not. Below is my structure: Food (section ...
3
votes
1answer
247 views

Sort CP Entries by Category

I know it's possible, using modifyEntrySortableAttributes, to sort the CP entries table by a custom field, when that field is a number, string, date/time, or bool. Would it be possible to sort a CP ...
1
vote
1answer
400 views

Craft 3 - How do you programatically update a field type that is a Category?

I have a Category element, locations, which I am trying to update programatically through a Craft 3 plugin that reads data from a CSV. The locations category has a Field Layout: latitude (Number), ...
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 ...
1
vote
1answer
548 views

Craft 3 - Can't access the craft() in plugin controller

I'm making a Craft 3 plugin to read a CSV file and insert the data as Categories. I used pluginfactory.io to scaffold my plugin. I can't access craft() in my controller (ImportCsvController.php). ...
1
vote
1answer
98 views

How to include search results where keyword input exists only as a category title?

I have a request to extend an existing "advanced search" form (multiple fields, including keyword and a categories dropdown) so that entries with a category that matches the keyword input are returned....
1
vote
1answer
93 views

Fetch category name

How can I display category name on template used in user->group. {% for restaurant in craft.users.username(userId) %} {{ restaurant.name }} {{ restaurant.addressLine1 }} {{ restaurant....
3
votes
1answer
1k views

Element API display entries by category

With v2 of the Element API plugin, I'm having issues with working out how to return entries that are in a particular category. I've got the slug in the API route but can't work out what the query ...
1
vote
1answer
163 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. ...
1
vote
0answers
258 views

Category counts for query results

I'm trying to display results from a search. I want to display the categories represented by the search results and the entry count for that category. Think of how Amazon's "refine results" sidebar ...
1
vote
1answer
47 views

Entries from different category levels brought together

I have an issue with categories with different levels: I have a group of categories which have a structure like this: First form: 1.0 Group – 1.1 Subgroup – 1.2 Items in subgroup Second form: - 1....
4
votes
1answer
84 views

Store categories in array by level in controller

I'm making a plugin and I need to get an array from a certain category group where the levels of the array are the same as the level of the categories in the group. So I used the following code to ...
1
vote
1answer
20 views

error when trying to loop through grouped entries according to dropdown field

I was trying to follow this example from stack overflow to loop through a list of entries and output them by a custom dropdown field {% set allEntries = craft.entries.section('resource').find() %} {% ...
1
vote
1answer
73 views

One select search for Users in user.group

I'm a complete newby on Craft CMS and twig templating so please bear with me. I currently have a users base which I want to filter by category (a custom field) This would be my only input search ...
1
vote
1answer
87 views

relatedTo working for one category group but not another

I'm trying to show a list of entries related to the same category on a page that contains a single entry. I have two category separate category fields in the entry, both with one category each ...
1
vote
1answer
362 views

Selecting descendants of a category when ancestor is clicked

I have a question about combining Twig and jQuery in Craft. I have a couple of filters on a page that outputs some entries: http://www.joycefdn.org/grants My categories are organized like this: ...
1
vote
1answer
27 views

Category Sources plugin not showing headings

Like the title tells you the headings, titles of the category groups, are not showing in the sidebar. This is a screenshot from the github page of the plugin. The "FOOD" and "DRINKS" titles are not ...
2
votes
1answer
97 views

Plugin Development: find source group used by field

I'm writing a plugin that works with Fields in various ways, one thing I need to do is get the category source groups available to a particular category field. I have the field's handle and id and can ...
1
vote
1answer
131 views

Building a filtering system using both OR and AND relations

I'm trying to set up a filtering system similar to the one found on the product pages on asos.com. That system has different category groups of filters, where selecting multiple filters inside a ...
1
vote
1answer
202 views

Get the category into the url of the product page

I'm in the middle of learning Craft Commerce. When I go to an individual product my URL says /shop/wella-shampoo/. I'd like it to say /shop/**hair-care**/wella-shampoo/ because this is the category ...
1
vote
1answer
388 views

Element API with multiple categories gives back error 500

This works fine on localhost but crashes on remote Server. I can return one category, but it will crash when I try to display multiple categories. I also tried to save the categories in a variable and ...
2
votes
1answer
239 views

In Craft 3, (how) can I disable a category on a per site basis?

In the CP, is it possible to disable Category X for site A, and not for Site B? And if so, how?
2
votes
1answer
63 views

Multiple Tag Groups/Sets for separate channels

I have two separate channel types, let's say "News" and "Reviews" and each of those can have tags. Is it possible to have separate tags for each of those? So News has it's own set of tags, that can't ...
1
vote
1answer
382 views

Setting the page title for a category page

I am trying to get the page title of the categories page. Currently it shows as: category-name, but I would like to have it set to Category Name to match the category.title. My categories/index.html ...
1
vote
1answer
350 views

How to load entries with a certain category only?

I am trying to load entries from a section which have a category field with multiple values. Based on that, I want to show specific entries filtered by category. Example: I have a news section and I ...
2
votes
1answer
656 views

How do I output the value of a field from a Category selected from a Matrix?

I'm new to craft so this is a bit newbie question. I have a category group with a set of categories, each category has a plain text field associated with it. The category group is then used as a ...
1
vote
1answer
386 views

Pass 'not' category.id to relatedTo in Craft

I have a search page that filters with these params: {% set results = craft.entries({ section: 'properties', price: range, search: query.location, relatedTo: status, order: ...
3
votes
1answer
348 views

How can I use categories to filter entries?

It's a pretty basic question, but for some reason all of the possible solutions do not work for me. I tried this: https://craftcms.com/docs/relations#the-relatedTo-param And also this (which I ...
1
vote
1answer
177 views

hide section entries from one section

I’m new at Craft CMS and I hope someone of you could help me a little. At the moment I get all entries from my blog by {% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage) ...
2
votes
0answers
115 views

Filtering products by categories and showing number of products related to selected category

I currently have about 420 products and over 100 of categories to choose from for each products, showing the list of categories and filtering it, works fine, and performance is not too bad when it's ...
2
votes
1answer
472 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) ...
1
vote
2answers
138 views

User defined order for categories

I'd like to set a user defined order for a Categories field. For example, categories are: Cat A Cat B Cat C I'd like to give the ability for users to drag and drop the order, to say: Cat B Cat A ...
1
vote
1answer
783 views

Filtering Search Results by Category

I'm currently trying to filter my search results by category, I've been following this tutorial but cannot get it to work. It keeps not adding on the category parameter, but instead just replaces the ...
2
votes
2answers
462 views

Multiple category relationship criteria (or)and(or)

Is there a way to do relatedTo categories where the category is (a or b) and (c or d or e)? I can get (a or b) working using: {% paginate craft.commerce.products.relatedTo(categories).limit(20) as ...
2
votes
1answer
57 views

Associate child categories only to an entry

When adding a Categories field to a section, if you select only child categories, Craft automatically selects the parent categories too. I emailed Craft support about this and they explained it's by ...
1
vote
1answer
109 views

Setting Variable to Specific Category for Loop

How do you set a variable to a specific category so you can do an if or for loop? I have entries(staffList) associated to categories (Management,Staff,Other,PartTime)and I am trying to set a variable ...
1
vote
1answer
88 views

Pulling categorized entries in a category loop

I am trying to pull channel entries and display them using a loop. These entries would then be organized by the category they are assigned to based on a categoryfield a user selects when creating the ...
0
votes
1answer
237 views

Refresh Craft for loop with form parameters

Recently new to Craft and Twig although I have used Expression Engine in the past. I am looking for a way to update a for loop that is pulling entries from a defined category based on the current ...
2
votes
1answer
199 views

Load entries based on category field value while multiple categories are selected

I have an activity calendar (more like a weekly schedule) which filters per day and per category. Because there are so many activities I can't just load them all in at once so I use some sort of Ajax ...
1
vote
1answer
416 views

List entries by category

I have a number of entries that all belong under a Channel that I created. Each entry has a category field where the user can select one or many categories to associate the entry with. I am ...
1
vote
1answer
62 views

Dynamic fields layout based on categories

I have entries called products. Those entries are organized in categories. I'm using fields to save technical data for each product ( ex. Flow rate, Pressure, Voltage, etc. ). Not all fields suit all ...
2
votes
1answer
291 views

Why isn't relatedTo not working (anymore)?

I’m using a structure for creating new pages and navigation. In this structure there are multiple entry types where one is used for creating category pages. Here a user can add some content and select ...
1
vote
1answer
73 views

Category slug variable is not available when category url's are disabled

Just like the title states, the slug variable is not available when a category's url are disabled: <select name="field-styles" id="field-styles" class="select"> <option value="">Style&...