Questions tagged [categories]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
573 views

List the categories an entry is part of?

I'm new to all of this and so far Categories from a templating point of view are confusing me a bit. I'm loving Craft so far but some concepts are causing me some headaches to adjust to! What i'm ...
1
vote
1answer
384 views

frontend editing, show selected category

I have this in my edit form {% set categories = craft.categories.group('jobCategory') %} <label for="fields[jobCategory]">Job Category:</label> <select id="jobCategory" name="...
2
votes
1answer
661 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
766 views

If Entry is related to Category-A, then print xyz

I have succussfully been able to list entries within the 'brandx' category slug, but I can't figure out a way to print specific content only if the current 'product' listing is related to the 'brandx' ...
1
vote
2answers
1k views

Error when using if statement in template

I have a page that shows all photos in a category, which is set by the last url segment and then the results re paginated. What i'm trying to do is say that if the last segment is 'all' then show all ...
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('...
1
vote
1answer
529 views

How to order categories in key/value for loop?

This is what I'm trying to accomplish: All categories displayed on one page, with entries returned from each. Only six entries shown in each category. Categories need to be in a specific order. I've ...
1
vote
2answers
1k views

relatedTo 'and' with 'or'

Is the following possible: {% set issue = craft.entries(section: 'issues', slug: 'october-2014').first() %} {% set categoryOne = craft.categories({ group: 'articles', slug: 'category-slug-one'}) %} {...
2
votes
1answer
119 views

How do I show entries that do not have a certain category?

I’m aware of the relatedTo() parameter for entries that belong to a category but how can I show entries that are NOT relatedTo() a certain category?
1
vote
1answer
565 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): ...
1
vote
1answer
641 views

List entries related to several categories

This is the code used to display entries related to categories. The issue: if an entry belongs to 2 categories, it displays all the categories to which it belongs on the page. I need Craft to ...
2
votes
1answer
775 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
240 views

Selecting categories by first letter

I'm attempting to pull out a list of categories starting with certain letter(s). What I've come up with so far seems a little excessive and I'm wondering if I've missed something obvious. Can it all ...
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 ...
1
vote
1answer
247 views

What is the best way to have an entry for top-level categories?

I'm currently working on an eCommerce project with categories for products: - Category 1 - Sub-category 1 - Sub-category 2 - Sub-category 3 - Category 2 - Sub-category 1 - Sub-...
1
vote
1answer
651 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 ...
0
votes
2answers
259 views

Category ID not being returned

So, in my template I get what I'm calling parentCategory, and I can output what I need: {% set parentCategory = craft.categories.slug(craft.request.getSegment(2)) %} {# parentCategory.title and ...
0
votes
1answer
806 views

Listing Sub Categories of a Category related to an entry

I've been scratching my head over this for awhile and I can't seem to solve it. What I'm after is the following. I have various categories with numerous sub categories. I'd like to be able to ...
0
votes
0answers
20 views

Is it possible to add a category to an object through twig? [duplicate]

I'm currently working on a registration page for users on a site. There are two attributes that users may have on sign up that I need to reflect in the sign up process. (I will probably use ...
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
1k views

How can I get blog categories and blog entry urls to play nice together?

I'm building a simple blog that has the ability to publish entries: Within a set of categories. With no category set. The URL format of a blog entry is /blog/YYYY/MM/DD/{slug} Everything so far ...
1
vote
1answer
2k views

Display entries related to a category (only bottom level)

I have a 2 level category system. Some have children, some do not. How can I display entries related to the last level only? If a category has no children, it should show the entries related to the ...
3
votes
1answer
814 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 ...
0
votes
1answer
471 views

Import Entries with Categories

I posted this on github already but I thought I would ask her as well to see if anyone has any ideas Im trying ot do a simple import of some organizations with categories and parent organization ...
4
votes
1answer
255 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'))...
2
votes
0answers
75 views

Showing entries based on parameters that may or may not be populated [duplicate]

I'm using a Matrix Field to display lists of entries. One extracts entries based on certain categories. They may or may not be set, but I need to use an "and" relatedTo parameter. At the moment it ...
2
votes
2answers
2k views

Sorting categories by the post date of the entries related to them

I need to sort my categories based on the date of entries returned within the category. I am trying to sort sermons from a church by the series they were contained within. I have the sermons grouped ...
4
votes
2answers
692 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 ...
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:...
2
votes
1answer
862 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 ...
9
votes
1answer
3k views

How to list entries related to a category + related to a section?

Sorry if this has been asked before. I've searched for other relatedTo questions but could not find anything similar. I have 2 sections (each having 1 entry type): games reviews Games are linked ...
1
vote
1answer
436 views

entries related To category not working with getNext function

I currently have one entry in a page and would like to display next and previous arrows. The next/previous entries should be in the same section and related to the same category. To do this I have ...
7
votes
1answer
765 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)?
2
votes
1answer
887 views

List all entries in a section filtered by given category groups

I've got a section called 'web development' and there are four categories that apply to it. Three can be grouped together as 'original content' and one is a link list to external third party content. ...
2
votes
1answer
486 views

How can an entry type have its own search and categories?

I have an entry type whose content will be separated from the main content. So I was wondering how can we give an entry type its own search and categories? Possible?
1
vote
1answer
1k views

How do I get entries of a child category, related to a parent category, defined in a URL segment?

My entry url structure looks like this: http://site.com/section/category/subcategory/entry_slug I'm trying to drill down to specific entries by using the url structure and I'm currently having ...
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 ...
2
votes
1answer
154 views

How do I find the category an entry belongs to?

I have a channel with entries which have a category field which is required. When the entries are listed on a page how do I find the category that it belongs to? {% for entry in entries %} <...
2
votes
1answer
180 views

Related category on a single page

Been trying for days to figure this one out. How do I extract entries from a channel and display only entries related to a category? How do I pull in the related photo? I have this code below but it ...
4
votes
1answer
475 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.
1
vote
0answers
17 views

How do I omit a page with just a catagory [duplicate]

I have a channel with content and I want to only display content from a certain category. Should I use a slug? Just trying to wrap my head around this. This is what I have now: {% for product ...
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 ...
2
votes
1answer
173 views

Wrapping my head around Categories

I have a category group set up called 'gists'. I have entries that contain a category field which pulls in the category group 'gists'. Now I need to access entries that are tied to individual ...
2
votes
2answers
350 views

Showing specific category content as well as ALL

I have a photography website with just two categories, 'Lifestyle' and 'Food'. I have two problems: How to display the content I have a category group called 'photoCategories' to which I have ...
3
votes
1answer
691 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 ...
8
votes
2answers
492 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. ...
13
votes
1answer
6k views

Get category title by slug

I'm setting my categories by matching the third segment to a category slug. How do I get the category title? {% set catSlug = craft.request.getSegment(3) %} {% set category = craft.categories.slug(...
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. ...
2
votes
2answers
881 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=...
4
votes
2answers
800 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 ...