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
4
votes
1answer
653 views

How do you import hierarchical data that uses the adjacency list model into Craft Structures or Categories?

Craft makes it nice and easy for us to have hierarchy in Structures or Categories. Many other popular CMS platforms support hierarchical data as well but some support it using a different data model. ...
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 ...
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 ...
3
votes
3answers
719 views

Porting from EE - How to filter by category/segment in one template

Sorry if there is an answer out there for this, I've read quite a few posts but have got myself confused. I hope you can point me in the right direction. I have this code in my EE template: {exp:...
3
votes
1answer
310 views

Get related posts excluding current post in Craft 3

In Craft 3, I’m trying to get the five most recent other posts sharing a category with the current post. I got this far: {% for relatedPost in craft.entries.relatedTo(entry.newsCategory).limit(5) %} ...
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 ...
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 ...
3
votes
2answers
59 views

Showing a list of selected/related categories to entry

I have a suitability category field in my product type that allows the content writer to select which categories this product is associated with. But my issue is that on the product page I need to ...
3
votes
1answer
663 views

How to display all entries within a given category

I've got a category group called allcategories, inside of this is two categories called design and photo. I'm trying to filter all entries in the section projects by the category `photo' but none of ...
3
votes
2answers
496 views

Loading related entries by category using a select menu

I have a list of people (entries) who are related to Categories. I would like to create select menu which will change (filter) the people (entries) shown on the page depending on which category (...
3
votes
1answer
454 views

Get all entries attributed with category

Maybe I'm going mad here, but I can't figure out how to get all entries which are in a certain category. Following the syntax laid out here: http://buildwithcraft.com/help/entries-related-to-category ...
3
votes
1answer
570 views

Display a list of categories excluding the current one

In a template for a category page, I'm trying to output a list of links through to all categories within a category group but exclude the category that the user is on. Does that make sense? What I'm ...
3
votes
1answer
1k views

How do I combine search for categories and entries into one set of search results?

I have a search page. I can search either categories or entries using {% set entries = craft.entries.search(query).order('score') %} {% set categories = craft.categories.search(query).order('score') %...
3
votes
1answer
231 views

Saving Category through API

I'm trying to create a category through the api to import a load of datas, but I'm stuck, the category won't be saved, and the saveCategory() method just returns false $category = new CategoryModel(...
3
votes
1answer
536 views

Order by score and another field

Currently I am sorting a category template with this: 'featured desc, postDate desc' Works as expected. But I would like to sort it first on the featured field, then on the score. Such as 'featured ...
3
votes
1answer
121 views

How/Can does Craft handle ancestor/grandparent relationships?

I spent a fair amount of time yesterday searching for any other questions that may have been answered that are similar to this one, but haven't had much luck. Essentially what I want to do is to ...
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
438 views

Output entries sorted by category title and paginate

I'm stuck on an issue where I have to paginate a list of entries that would be sorted by category title. So basically, I need to: fetch entries in the 'project' section sort those entries by the '...
3
votes
1answer
379 views

Cannot select subcategory field in entity

I have a Structure section fruit with a single entry type fruit. I also have a Category fruitType with 2 levels: Citrus Orange Lemon Lime Melons Watermelon Honeydew The entry type fruit has a ...
3
votes
1answer
883 views

Filter by multiple categories

I need to filter a sections entries by more than one category but only return entries that belong to all category id's passed in a URL parameter. Now I can get the correct output if the id's are hard ...
3
votes
2answers
970 views

Adding active class to category link

I have a category page displaying only the entries associated with the respective category. I have added a dynamic sub nav for categories using the following: <ul> {% nav category in craft....
3
votes
1answer
143 views

How to handle 'related' categories within import script

So I'm attempting to hack together a script to import thousands of entries and hundreds of categories from a bespoke system. I have imported all the categories (around 800 of them) successfully. The ...
3
votes
1answer
26 views

Output values from all entries in a specific section EXCEPT those with a specific category id

Currently, this is NEARLY doing what I want except instead of the output being entries that do NOT have the id, it's output is ONLY the entries with the id. I'm not sure why, since I've included the '...
3
votes
1answer
153 views

Garnish - Event when selecting a category

I have a "Categories" field in my section. I want to perform some JavaScript actions when a category is selected. Is there any built-in event which will be triggered at that point?
3
votes
1answer
323 views

List Categories AND their associated entries

I'm trying to create a category driven gallery. My setup (right or wrong) is this:- Users create a new entry within a Structure, title it, add photos and then assign the entry to a pre-defined ...
3
votes
1answer
827 views

Getting entries related to current entries categories

Trying to get 10 entries related to the current entry categories excluding a category called featured. I don't have the category name(s) in the url. This currently what I tried but this does not work,...
3
votes
1answer
251 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 ...
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 ...
3
votes
1answer
248 views

Category name in page title

All I'm trying to do is put the category title on a category listing page into the title tag. So I've got the variable set up, but if I add the category title tag: {% set title = "{{ category.title }}...
3
votes
1answer
88 views

How to merge/combine/transfer-entries-between two categories in the CP?

I’ve got 2 categories each with lots of entries. The client wants to delete one category, and transfer it’s entries into the other one. If I delete the category, it just disappears, but I somehow ...
3
votes
1answer
546 views

Fields associated with a category group

I have set up a custom field for a category group. How do I get the value of this field in a loop that goes through entries? Each category in the group could have this field's value set as true or ...
3
votes
1answer
350 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 ...
3
votes
1answer
280 views

Dynamic Category template paths

I've got a site with several locales and want to reuse a set of categories across locales but want to target a locale specific template from within each. Is it possible to set a locale-specific path ...
3
votes
1answer
412 views

Category slug is getting numbers appended to it

I have a category Australia and have been experimenting with boboldehampsink import plugin. After deleting categories and starting over the category Australia now has a slug called 'australia-6'. I ...
3
votes
1answer
716 views

Search for related entries via AJAX given multiple parameters

I am attempting to create a relationship between products. I have a section named "product" which is a Structure. Each "product" entry has a category field called "species" and a category field called ...
3
votes
1answer
46 views

Have some categories NOT linked to a category entry

So my client has thrown a curve ball! I've set-up a list of categories for the types of work they cover. However, they DON'T want all of the categories to actually link to an entry. In other words, ...
3
votes
1answer
100 views

Show the entry category, that´s it

I have a simple and maybe a stupid question, it´s my first Craft Website... I´m listing a news section, the news can be categorized ( max two categories ), and i don´t know how to show the category ...
3
votes
3answers
106 views

Plugin for creating categories on an entry page in Control Panel

Is there a plugin that allows to add a category via an entry page? I like how you're able to add categories in Wordpress admin right on a post page, not only via Categories section — this seems to ...
3
votes
1answer
1k views

Load Category in Plugin

I have a category that I'm trying to load via a plugin. Looking at the categories service I see there is a function called "getCategoryById" but I don't know what the ID is so instead I'm loading the ...
3
votes
1answer
139 views

High volume category list causes slow load

My customer has 3500 categories in a 3 level hierarchy. This is causing some significant pain when adding categories to an entry. The server delivers the categories via ajax in 9sec, but the browser ...
3
votes
1answer
679 views

Assign entries to categories in bulk?

I just accidentally dragged a root category onto another. Now, all of the entries that were assigned to that category are assigned to the one I accidentally dragged it onto. Luckily, I have like 7 ...
3
votes
2answers
666 views

Submitting checkbox data from a front-end form for a 'Categories' Field Type

I have read a few docs about front-end forms such as the Checkbox field docs. Although that doc doesn't seem to give an example of what I need. I have a 'categories' field type. I am creating a ...
3
votes
1answer
205 views

Categories within matrix for relatedTo

I have a matrix field with a category field. I need to group these matrix items by category and give them headings which I'll use for tabs. This is how I'd do it for entries but is it possible for ...
3
votes
1answer
208 views

Localization with categories

I am using Lindsey's Language Link plugin for my language switcher. Everything works well, as long as the url is not a category url. Here it is: {% set element = (entry is defined ? entry : null) %}...
3
votes
1answer
728 views

Limit category choice in entry to 1 and select child category

I have a section of book entries with a categories field called "Genre". A book can fall into multiple genres. A stripped down version of the categories works something like this: Fiction Crime, ...
3
votes
1answer
50 views

How to plan IA for a directory of content thats good for admins and users

I want to build a directory of fishing ports It will have approx 500 entries, each geocoded for map display. I will have 4 views; 1) Directory with map of entries 2) Country and entries 3) Cities (...
3
votes
1answer
141 views

Showing entries within a category

I have a list of people with skills defined by a category group. I have a category field within the 'people' Section so when a new person (entry) is created, the category field allows the admin to ...
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 ...
2
votes
2answers
964 views

How do I list category name?

Forgive the simplicity of this question but I am in the early stages of my first Craft implementation. My simple question is: how do I display a category name in a template. This is the code I am ...
2
votes
2answers
1k views

Conditional Logic to show or hide fields in the admin?

I'm looking for a way to show or hide fields when editing an entry based on items selected. I need to manage a list of businesses and my plan is to have a channel to hold them all. But based on the ...