<p>Give this a try. I'm not 100% sure I've got my site set up the same, but I think it's close.</p>

<p>I have a category group called <code>Categories</code>. It looks like this:</p>

<pre><code>Categories
    b2a    
    b2b
    b2c
</code></pre>

<p>I created a section called <code>homeBlocks</code> which is a channel (shouldn't matter).
Then on my entry, I have a Categories field with a handle of <code>categoryOne</code>.</p>

<p>On my template:</p>

<pre><code>{% set category = craft.categories.slug('b2c') %}
{% set entries = craft.entries.section('homeBlocks').relatedTo(category).find() %}

{% if entries | length %}
    {% for entry in entries %}
        &lt;p&gt;{{ entry.title }}&lt;/p&gt;
    {% endfor %}
    {% else %}
        {# No entries found. #}
{% endif %}
</code></pre>

<p>I have created 3 entries within my <code>homeBlocks</code> channel, and I've assigned the 1st entry and the 3rd entry to b2c. </p>

<p>Now I am seeing this when I view the page:</p>

<pre><code>&lt;p&gt;Entry Three&lt;/p&gt;
&lt;p&gt;Entry One&lt;/p&gt;
</code></pre>

<p><strong>EDIT</strong></p>

<p>Sorry for the bad info - I think I understand what you are looking for now. I've updated my answer so give it another try.</p>

CC BY-SA 3.0
2015-12-03T19:22:35.940Z
Thanks Damon. Tried it but It shows all entries like my second code example... but i only want the entries with category slug "b2c". So i guess in your example without "Entry Two b2c Business Segment"
Dave Driesmans
CC BY-SA 3.0
2015-12-03T18:55:24.140Z
2015-12-04T12:34:03.407Z
2015-12-04T12:34:03.407Z
Damon
<p>Should be easy i thought. How can i display all entries from a section from a certain category?</p>

<p>This is my code now, but nothing shows up (screenshot bottomleft):</p>

<pre><code>{% set category = craft.categories.slug('b2c').first() %}
{% set entries = craft.entries.section('homeBlocks').relatedTo(category).find() %}

{% for entry in entries %}
    {{ entry.title }}
    {% for cat in entry.businessSegment %}
        {{ cat }} 
    {% endfor %}
{% endfor %}
</code></pre>

<p>This code shows all entries (screenshot topleft), and you can see there are entries with b2c:</p>

<pre><code>{% set category = craft.categories.slug('b2c').first() %}
{% set entries = craft.entries.section('homeBlocks').find() %}

{% for entry in entries %}
    {{ entry.title }}
    {% for cat in entry.businessSegment %}
        {{ cat }} 
    {% endfor %}
{% endfor %}
</code></pre>

<p><a href="https://i.sstatic.net/03wN4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/03wN4.png" alt="screen shot"></a></p>

<p>My Category Group is called Business Category (with handle "<em>businessCategory</em>"). It contains two categories:</p>

<ul>
<li>b2c (slug "<em>b2c</em>")</li>
<li>b2b (slug "<em>b2b</em>")</li>
</ul>

<p>The field handle used in the section "<em>homeBlocks</em>" is "<em>businessSegment</em>"</p>

<p>Where's the error? :)</p>

CC BY-SA 3.0
2015-12-03T18:08:27.543Z
What happens if you take the `find()` off of your `relatedTo`? So it becomes: 
`{% set entries = craft.entries.section('homeBlocks').relatedTo(category) %}`
Damon
CC BY-SA 3.0
2015-12-03T18:32:04.887Z
@damon same result: no entries
Dave Driesmans
CC BY-SA 3.0
2015-12-04T12:34:45.583Z
I think I understand what you are trying to get. I've updated my answer - see if that gets you closer to what you need.
Damon
<categories>
Entries from hardcoded category
# Entries from hardcoded category

(Asked by: username_0 on 2015-12-03)

Should be easy i thought. How can i display all entries from a section from a certain category?
This is my code now, but nothing shows up (screenshot bottomleft):
{% set category = craft.categories.slug('b2c').first() %}
{% set entries = craft.entries.section('homeBlocks').relatedTo(category).find() %}

{% for entry in entries %}
    {{ entry.title }}
    {% for cat in entry.businessSegment %}
        {{ cat }} 
    {% endfor %}
{% endfor %}

This code shows all entries (screenshot topleft), and you can see there are entries with b2c:
{% set category = craft.categories.slug('b2c').first() %}
{% set entries = craft.entries.section('homeBlocks').find() %}

{% for entry in entries %}
    {{ entry.title }}
    {% for cat in entry.businessSegment %}
        {{ cat }} 
    {% endfor %}
{% endfor %}


My Category Group is called Business Category (with handle "businessCategory"). It contains two categories:

b2c (slug "b2c")
b2b (slug "b2b")

The field handle used in the section "homeBlocks" is "businessSegment"
Where's the error? :)

**Tags:** categories
> **Comments:**
> **username_1**: What happens if you take the `find()` off of your `relatedTo`? So it becomes:  `{% set entries = craft.entries.section('homeBlocks').relatedTo(category) %}`  
> **username_0**: @damon same result: no entries  
> **username_1**: I think I understand what you are trying to get. I've updated my answer - see if that gets you closer to what you need.  

---

## 1 answers

### Answer by username_1 on 2015-12-03. Score: 1 | Accepted answer

Give this a try. I'm not 100% sure I've got my site set up the same, but I think it's close.
I have a category group called Categories. It looks like this:
Categories
    b2a    
    b2b
    b2c

I created a section called homeBlocks which is a channel (shouldn't matter).
Then on my entry, I have a Categories field with a handle of categoryOne.
On my template:
{% set category = craft.categories.slug('b2c') %}
{% set entries = craft.entries.section('homeBlocks').relatedTo(category).find() %}

{% if entries | length %}
    {% for entry in entries %}
        {{ entry.title }}
    {% endfor %}
    {% else %}
        {# No entries found. #}
{% endif %}

I have created 3 entries within my homeBlocks channel, and I've assigned the 1st entry and the 3rd entry to b2c. 
Now I am seeing this when I view the page:
Entry Three
Entry One

EDIT
Sorry for the bad info - I think I understand what you are looking for now. I've updated my answer so give it another try.

> **Comments:**
> **username_0**: Thanks Damon. Tried it but It shows all entries like my second code example... but i only want the entries with category slug "b2c". So i guess in your example without "Entry Two b2c Business Segment"  

---

