Skip to main content
added 31 characters in body
Source Link
Clive Portman
  • 2.9k
  • 19
  • 36

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}

UPDATE: Following on from your updated question, you've already got the category as an object so there is no need to get it again. Try replacing:

// THIS IS YOUR LOOP, BTW
{% for category in craft.categories.group('productType').find() %}       
    <header class="flush"><h1>{{ category.title }}</h1></header> 
{% endfor %}

with:

{{ category.title }}

But you might need to add a conditional in case the page is loaded without a category. Something like:

{% if category | length %}
    {{ category.title }}
{% endif %}

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}

UPDATE: Following on from your updated question, you've already got the category as an object so there is no need to get it again. Try replacing:

{% for category in craft.categories.group('productType').find() %}       
    <header class="flush"><h1>{{ category.title }}</h1></header> 
{% endfor %}

with:

{{ category.title }}

But you might need to add a conditional in case the page is loaded without a category. Something like:

{% if category | length %}
    {{ category.title }}
{% endif %}

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}

UPDATE: Following on from your updated question, you've already got the category as an object so there is no need to get it again. Try replacing:

// THIS IS YOUR LOOP, BTW
{% for category in craft.categories.group('productType').find() %}       
    <header class="flush"><h1>{{ category.title }}</h1></header> 
{% endfor %}

with:

{{ category.title }}

But you might need to add a conditional in case the page is loaded without a category. Something like:

{% if category | length %}
    {{ category.title }}
{% endif %}
Responded to updated question
Source Link
Clive Portman
  • 2.9k
  • 19
  • 36

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}

UPDATE: Following on from your updated question, you've already got the category as an object so there is no need to get it again. Try replacing:

{% for category in craft.categories.group('productType').find() %}       
    <header class="flush"><h1>{{ category.title }}</h1></header> 
{% endfor %}

with:

{{ category.title }}

But you might need to add a conditional in case the page is loaded without a category. Something like:

{% if category | length %}
    {{ category.title }}
{% endif %}

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}

UPDATE: Following on from your updated question, you've already got the category as an object so there is no need to get it again. Try replacing:

{% for category in craft.categories.group('productType').find() %}       
    <header class="flush"><h1>{{ category.title }}</h1></header> 
{% endfor %}

with:

{{ category.title }}

But you might need to add a conditional in case the page is loaded without a category. Something like:

{% if category | length %}
    {{ category.title }}
{% endif %}
Source Link
Clive Portman
  • 2.9k
  • 19
  • 36

It depends how you're fetching the category. But if you've defined the template when setting up the categories it would be called be within a var called 'category', which would be a category object. You should then be able to access it using:

{{ category.title }}

If, on the other hand, you were getting the category via a slug in the URL, you would do something like:

{% set category = craft.categories.group('productType').slug(craft.request.lastSegment).first %}
{{ category.title }}