Answers.Body: <p>I take it you are on the category template as defined in <code>admin/settings/categories/:id</code>.</p>
  
  <p>You should have a model representation of the category assigned to <code>category</code> in the template, so you should be able to get the current category id by simply doing <code>{{ category.id }}</code> in the template.</p>
  
  <p>Your code could look like:</p>
  
  <p><code>for cat in craft.categories.group('productCategories').descendantOf(category.id)</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-14T13:39:46.133Z
Answers.Text: Great, that's the issue, as I said I haven't used categories before so I thought I could use the entry variable but this makes sense as it's a category not an entry!
Answers.UserDisplayName: Mark Gifford
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-14T13:19:21.097Z
Answers.LastActivityDate: 2015-08-14T13:19:21.097Z
Answers.UserDisplayName: Alec Ritson
Answers.Body: <p>When you are on a category page you can simply use the category variable just like you would use the entry variable...</p>
  
  <pre><code>{{ category.id }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-14T14:14:48.133Z
Answers.LastActivityDate: 2015-08-14T14:14:48.133Z
Answers.UserDisplayName: j00lz
Body: <p>I haven't used categories before so maybe I'm looking at this the wrong way.</p>
  
  <p>I currently have a category group named products with the following structure:</p>
  
  <pre><code>Featured
  Fruit
  ----Apple
  ----Banana
  Veg
  ----Turnip
  </code></pre>
  
  <p>I know I can do the following to show just the subcategories of fruit:</p>
  
  <pre><code>for cat in craft.categories.group('productCategories').descendantOf("fruit ID")
  </code></pre>
  
  <p>But how do I get the "fruit ID" when I'm on the on the fruit page?</p>
  
  <pre><code> craft.categories.relatedTo(entry)
  </code></pre>
  
  <p>returns all the categories in products but I want just the current category.</p>
  
  <p>Any help greatly appreciated!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-14T16:05:15.383Z
Comments.Text: I hate to be "that guy", but technically a tomato is a fruit. ;)
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-20T18:37:37.407Z
Comments.Text: the craft page on categories is a great way to learn some other elements of categories you might need for success. http://buildwithcraft.com/docs/categories
Comments.UserDisplayName: Matteo
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-30T04:35:21.873Z
Comments.Text: @BradBell for president
Comments.UserDisplayName: Anna_MediaGirl
Tags: <entries><categories><relations>
Title: Get current entry category
ThreadText: # Get current entry category
  
  (Asked by: username_0 on 2015-08-14)
  
  I haven't used categories before so maybe I'm looking at this the wrong way.
  
  I currently have a category group named products with the following structure:
  
  ```
  Featured
  Fruit
  ----Apple
  ----Banana
  Veg
  ----Turnip
  
  ```
  
  I know I can do the following to show just the subcategories of fruit:
  
  ```
  for cat in craft.categories.group('productCategories').descendantOf("fruit ID")
  
  ```
  
  But how do I get the "fruit ID" when I'm on the on the fruit page?
  
  ```
   craft.categories.relatedTo(entry)
  
  ```
  
  returns all the categories in products but I want just the current category.
  
  Any help greatly appreciated!
  
  **Tags:** entries, categories, relations
  
  > **Comments:**
  > **username_1**: I hate to be "that guy", but technically a tomato is a fruit. ;)  
  > **username_2**: the craft page on categories is a great way to learn some other elements of categories you might need for success. http://buildwithcraft.com/docs/categories  
  > **username_3**: @username_1 for president  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2015-08-14. Score: 2 | Accepted answer
  
  I take it you are on the category template as defined in `admin/settings/categories/:id`.
  
  You should have a model representation of the category assigned to `category` in the template, so you should be able to get the current category id by simply doing `{{ category.id }}` in the template.
  
  Your code could look like:
  
  `for cat in craft.categories.group('productCategories').descendantOf(category.id)`
  
  > **Comments:**
  > **username_0**: Great, that's the issue, as I said I haven't used categories before so I thought I could use the entry variable but this makes sense as it's a category not an entry!  
  
  ---
  
  ### Answer by username_5 on 2015-08-14. Score: 1
  
  When you are on a category page you can simply use the category variable just like you would use the entry variable...
  
  ```
  {{ category.id }}
  
  ```
  
  
  ---
  
  