Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [categories]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
224 views

How do you get all the categories in a category group in a controller?

I want to get all the categories in a specific category group inside my controller. How do you do that?
1
vote
2answers
654 views

Use blog index template as category template

I have a blog listing page which works correctly. I also have categories that I would like to use the same template rather than creating a whole new template since the design is exactly the same. ...
2
votes
1answer
578 views

How can I get an entry's child category, and not the parent category?

I have a category page that lists all of the entries related to that category. And then I want to display the selected child category for the entry... in brief like so: Entry Title 1 Entry 1's Child-...
0
votes
1answer
17 views

Move Icon Disappears from Categories editor

The move symbol - the one that allows you to move a category in the list up or down, etc. -- is gone from one of my category groups. It's the one that appears just after the checkbox to select a ...
2
votes
1answer
208 views

What's the trick to importing an entry with a categories field?

We are using Hampsink's Import plug-in (0.8.33) and we have a very simple CSV for testing. One row, three columns. One of these columns contains a comma-separated list of categories. These are top ...
1
vote
2answers
135 views

Categories, Single and Channels …SEO

Background... I took a look at this post answered by @Damon My objective is similar. I have a channel for news. Each entry in news is assigned various categories (e.g. product category). I do ...
3
votes
1answer
120 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 ...
1
vote
1answer
140 views

map values from checkbox field into category field using SQL

In a project I have a checkbox field called gradeLevels with 3 options (k-5,6-8, and 9-12). Due to design changes, I need to convert this field into a category field. I've made a new category with ...
2
votes
1answer
285 views

Selecting entries using a checkbox field

I had what I thought was a very simple issue: Select some categories on the front-end, filtering by a Checkbox field. The Checkbox has values, which correlate to Locales. The end goal was to create ...
1
vote
1answer
79 views

Related Items in a Category not Appearing in Results

I am still having a problem looping through related posts. I get zero, not even the HTML. And there are no Craft template errors. There are plenty of entries that were assigned the same market, so ...
2
votes
1answer
82 views

Categories not adding trailing slash

In my general config I have enabled URLS to have trailing slashes. 'addTrailingSlashesToUrls' => true, This is working for products and entries. But it is not working on Categories. Category ...
2
votes
1answer
1k views

How to get parent categories from an entry?

I have a pretty standard type entry page (_entry.html) which displays the details of an entry having navigated to it through 2 levels of categories. On this page I'd like to be able to query the two ...
2
votes
1answer
400 views

Show Other Entries in Same Category

So, I am new. I want to display the 1-n most recent posts in the same category as the current entry (preferably excluding the current entry) -- i.e., I want to have a section with Other Similar Posts ...
2
votes
1answer
321 views

Query all categories once and get individual categories from array

I am working on a site that needs to both list all categories and also pull out individual categories by their id. I would like to query the DB once for all the categories (to improve performance), ...
2
votes
1answer
144 views

Show related entries that have the same Category, and some of the same tags?

I have succesfully shown some related entries that are in the same category, using the following: {% set relatedEntries = craft.entries({ section: 'blog', relatedTo: entry.blogCategory.first()...
1
vote
1answer
321 views

Tabbed Content & Categories - Tab ID html displays a category number instead of the slug

I want to make a tabbed content section of book citations where the tabs are years, made from categories. I am using a model I found in the cookbook here, which seems to be exactly what I am trying ...
1
vote
1answer
1k views

Set Twig variable with javascript/jquery for displaying entries based on clicked value

I have a filter system on my website which uses categories. The categories have all got their own ID tagged to their HTML Element. Now I just need to get the clicked checkboxes to add their ID to the ...
1
vote
2answers
763 views

Element API return a type of Category

I'm just wondering when it comes to Element API is there a way of returning a type of Category. I'm returning all the other information fine. 'fees.json' => [ 'elementType' => 'Entry', ...
1
vote
1answer
120 views

Target first and last items and append if greater than 2

I am trying to loop through a list of categories to add some text to the page. If it is the last item I want to replace the ',' with the words 'and' but only adda a ',' if there are more than 2 ...
1
vote
1answer
314 views

How to separate a parent and it's children when looping through a category?

I have categories of cities and states set up as parents and children, for example: California - Los Angeles - San Francisco New York - New York City When I use: {% for place in entry....
4
votes
1answer
930 views

Ordering of products?

What is the best method to organise products, and subsequently the order of these products within a group? Currently I have setup a product type of Canine. I can access each of these products via a ...
3
votes
1answer
708 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 ...
1
vote
1answer
112 views

Pull random image from entries marked with a certain category

I am trying to pull an image from services marked with a category of left. I would only like to display one image. I would also like to randomize the image if possible from all the images marked left. ...
1
vote
0answers
116 views

Compose entry URL with hierarchy

I’m moving new project from Wordpress to Craft, which has the hierarchy in URLs. I’m try to compose URL for this new project: New category field have an option "Limit the number of selectable ...
1
vote
1answer
294 views

Filter Entries within a page dynamically based on category

I'm creating a portfolio page, and I have a summary list of project entries displayed. At the top of the page, I've got a dropdown displaying a Category field. e.g. craft.categories.group('industry') ...
2
votes
3answers
710 views

Is it possible to bulk-edit a field across multiple entries at once?

I would like to know if it's possible to select multiple entries and update a field for them all at once – for example, give all the selected entries the same category.
2
votes
1answer
263 views

How to get data from Matrix field type?

I have a channel which is basically a list of articles. Each article is associated with one or more companies. When I click on companies I want to show all the articles related to the company. I got ...
1
vote
1answer
367 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 ...
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) { ...
1
vote
1answer
385 views

Find matching asset (image) for category

What would be the best approach to have a list of categories (brands in my case.) and if an asset (image) exists that matches that brand name show that asset or instead show a placeholder image. <...
1
vote
1answer
545 views

Sort entries in a category or entries field?

I have a Products Section and a Product Category Structure Section In Products there is an Entries Field where the Category is selected from the Product Category section. Is it possible to sort the ...
3
votes
1answer
205 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) %}...
5
votes
1answer
158 views

What is the difference between 'nav' and 'for' for looping?

I am new to craftcms and did a look through on the documentation just recently. I am at the part where it explain about the Categories Field and found out that we can loop through the ...
0
votes
1answer
79 views

Category list not returning all related entries

Here's my code: {% for category in craft.categories.group('artistLocation') %} {% set entryCount = craft.entries.relatedTo(category).total() %} {% if entryCount %} <li> ...
2
votes
1answer
84 views

Relating a Category Entry to a Categories Field Type

I've been trying to get this working but can't seem to find a solution. I have two different types of Categories in a commerce project. Level One Level Two Examples Level One would be Mens, Ladies,...
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
1answer
2k views

Using the Search Filter with Entry Fields

I've got an entry page and at the bottom I would like to show related products and then underneath that, related offers. As the main page entry isn't assigned to any categories I've tried to use a ...
1
vote
1answer
524 views

Entries from all categories in a category group via URL?

I'm familiar with the option in the category settings that allows for categories within a category group to each have their own URLs: I have this setup and it is working fine. However, I'm wondering ...
2
votes
1answer
315 views

Loop through entries that share current entry category and restrict to Cat Group Id

I've been racking my brains trying to get my head around categories and entries, hopefully someone can help and show me the best way. I have an entry page with product information and this product is ...
1
vote
1answer
101 views

Two sections sharing one category group

Just getting starting with templating so apologies if this is obvious. Couldn't find a solution through search. I have set up two sections. These contain different sets of information. I have one ...
2
votes
1answer
130 views

Setting up Route for Category-based RSS Feeds

I think that I need to set up a few routes to handle my category based RSS feeds. I have a current url structure as follows http://something.com/shows/wmr/marketing pr http://something.com/...
2
votes
1answer
561 views

Including two category slugs in entries’ URLs

I have a section with two Categories fields, and I would like the entries’ URLs to include the slugs of the categories selected in each of those fields. The Category Groups are: mySection Employees ...
2
votes
1answer
912 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
1answer
233 views

Display categories which only contain entries

I'm grabbing a list of categories and displaying their entry count. How can I only display categories which have entires? So I'm not getting any with 0 in them, which is occurring as I have a few ...
0
votes
1answer
126 views

Trying to capture categories field type data in user profile save/update

I am trying to capture the data that is selected when a user selects categories within a categories field type (handle: groups) within the Control Panel profile tab. I was looking thru the Fields, ...
1
vote
1answer
402 views

Assign category through a plugin

I am importing data into Craft. I happen to know that the id for my desired category is 22. The category is not being saved. Here is my code. $entry = new EntryModel(); $entry->sectionId ...
1
vote
0answers
153 views

How to display a nested list from a structure section based on categories assigned to last descendant?

I have a structure section, which allows categories to be assigned to the final descendant. I'm trying to list the entries by category, whilst including the parent structure entries (so the hierarchy ...
4
votes
3answers
812 views

Get entries by category value from within plugin

I need help. I want to get entries based on multiple field search. It works for basic field types like selectbox or plain text but I can't get it to work with Categories Fields. The field size is a ...
1
vote
0answers
51 views

How do I filter / restrict entries field in CP with a category

Is there a way to restrict the entry field type to specific categories? For example when adding a new field with type "Entries" to select the categories from where entries will be available. I found ...
0
votes
1answer
2k views

Issue with twig loop.first loop.last contained in nested for statement

I'm trying to pull out selected categories in a front-end user profile. The cats have 2 levels and need to be pulled out into a nested list with only the selected options. I've tried different ways of ...