<p>New Answer based on our discussion:</p>

<pre><code>&lt;!-- Step 1. get the category you want to exclude
     since I still don't know your structure I'll just grab it
     per id. You can see that in your cp edit url (the last number) --&gt;
{% set category = craft.categories.id(108).first() %}

&lt;!-- Step 2. get all entryIds related to that category --&gt;
&lt;!-- this should be an array of ids you can dump it to check them --&gt;
{% set entriesInCategory = craft.entries.relatedTo(category).ids() %}

&lt;!-- Step 3 exclude those ids from your last query --&gt;
{% set entries = craft.entries.section('blogItem').id('and, not ' ~ entriesInCategory|join(', not ')) %}

&lt;!-- just for debugging and testing if these are the correct one --&gt;
{% for entry in entries %}
    {{ entry.title }}&lt;br&gt;
{% endfor %}
&lt;!-- then you can use your paginate with those entries --&gt;
</code></pre>

<p>old Post</p>

<p>You can grab all entries that are related to category F and exclude them in your query</p>

<pre><code>{% set catF = craft.categories.group('categories').ids() %}
{% set entriesForCatF = craft.entries({
    relatedTo: catF,
}).ids() %}

{% set entriesNotInCategoryF = craft.entries.section('blogItem').id('and, not ' ~ entriesForCatF |join(', not ')).ids() %}


{% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage).id('and, not ' ~ entriesNotInCategoryF |join(', not ')) as pageActive, pageEntrys %}
</code></pre>

CC BY-SA 3.0
2017-10-23T09:13:36.887Z
Hey, thx for your help.
i changed each "CategoryF" and "CatF" by the real category name and i changed the "categories" in categories.group.
"blogItem" could stay.
But it wount work for me.
All i get is a clear div, without blogitems or errors.
SMueller
CC BY-SA 3.0
2017-10-23T09:16:23.137Z
can you debug every variable and tell me whats in there? just use `{{dump(variableName)}}` Because for me the code works
Robin Schambach
CC BY-SA 3.0
2017-10-23T09:47:40.893Z
Hope that will help:

`{{ dump(catF) }}
array(5) { [0]=> string(1) "4" [1]=> string(1) "5" [2]=> string(1) "6" [3]=> string(1) "7" [4]=> string(2) "36" }`

` {{ dump(entriesForCatF) }}
array(5) { [0]=> string(2) "37" [1]=> string(2) "13" [2]=> string(2) "10" [3]=> string(2) "11" [4]=> string(1) "9" }`
SMueller
CC BY-SA 3.0
2017-10-23T09:49:31.013Z
`{{ dump(entriesNotInCategoryF) }}
object(Craft\ElementCriteriaModel)#196 (17) { ["strictAttributes":protected]=> bool(false) ["_elementType":"Craft\ElementCriteriaModel":private]=> object(Craft\EntryElementType)#146 (7) { ["componentType":protected]=> string(11) "ElementType" ["_sourcesByContext":"Craft\BaseElementType":private]=> NULL ["_classHandle":"Craft\BaseComponentType":private]=> NULL ["behaviors"]=> array(0) { } ["_initialized":"CApplicationComponent"

I had to shorte this: too long by 7303 characters
SMueller
CC BY-SA 3.0
2017-10-23T11:45:29.207Z
I tried and testet some more time to use your code, but i cant find the position where i have to set the name or the id of the "hidden category", called catF in my example.

CatF: shows all ids from all categories
entriesForCatF: shows all Ids from all entries
entriesNotInCategoryF: shows 'array(0) { } '
SMueller
CC BY-SA 3.0
2017-10-23T11:51:24.540Z
Did you link all your entries with the categoryF? I don't know your structure. catF should display all rows in this category. If entriesForCatF display all id's you have an error in your structure since you must have linked every entry with these entries in some way or another.
Robin Schambach
CC BY-SA 3.0
2017-10-23T13:00:07.887Z
All categories (catA, ... , catF) are at the same level.
I use no higher levels and no sublevels

for testing, some of them have an entry. catF is filled with one entry
SMueller
CC BY-SA 3.0
2017-10-23T16:48:19.580Z
Do you really have 6 different categories or do you have 1 category with 6 entries?
Robin Schambach
CC BY-SA 3.0
2017-10-23T17:27:18.717Z
All in all 5 categroies, inkl.the special  "catF" and for Testing 5 Entries through all categories.
Later there will be a lott more entries, but for testing it is enough.
SMueller
CC BY-SA 3.0
2017-10-23T17:35:44.827Z
Maybe you could update the handles of your categories, I'll create the same structure and update my post.
Robin Schambach
CC BY-SA 3.0
2017-10-23T18:04:11.723Z
My categories are:
mietobjekte, kaufobjekte, gewerbeobjekte, anlageobjekte, Referenzen.
categorie-group-handle: immoCatGroup
The section-handle is: immoItem
Items from the first 4 categories will displayed at the Blog-page or at their categorie-page.
Items from "Referenzen" will just displayed at the Referenzen-Page
From time to time an item from one of the first 4 categories is taken to the  Referenzen-Page.

At the Moment i collect the Items by 
'{% paginate craft.entries.section('immoItem').limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}'

But this shows all Items
SMueller
CC BY-SA 3.0
2017-10-23T18:19:46.277Z
So you have one category with 6 different entries and not 6 different categories. Of course you'll fetch them all since I loop through every item in each category. I'll update my code tomorrow ~8am. Since we are both German it's the same time for you
Robin Schambach
CC BY-SA 3.0
2017-10-23T18:32:22.320Z
No, 1 Group, 5 Categories: 
1. mietobjekte, 2. kaufobjekte, 3. gewerbeobjekte, 4. anlageobjekte, 5. Referenzen.
If i visite the categoriy "kaufobjekte" i will just see the objects in this category. Each item can just have one category in my case.

Danke vorab für Deine unermüdliche Hilfe bei dem Versuch mir die Funktion der Kategorien in Craft bei zu biegen :-)
SMueller
CC BY-SA 3.0
2017-10-24T09:41:08.760Z
ok. Thanks for your Help. It did what it should, but when i throw the result in the paginate tag, the pagination woun't work. 

    '{% paginate entries.limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}
    {% for entry in pageEntrys %}
        {{ entry.title }}<br>
    {% endfor %}'

Is it possible to make the pagination work?
SMueller
CC BY-SA 3.0
2017-10-24T18:26:28.433Z
Ok. Thanks for all helping hands. 
I put the wrong array in the pagination region.
It looks like I have a working version :-)
SMueller
CC BY-SA 3.0
2017-10-23T06:56:35.013Z
2017-10-24T09:00:33.010Z
2017-10-24T09:00:33.010Z
Robin Schambach
<p>I’m new at Craft CMS and I hope someone of you could help me a little.
At the moment I get all entries from my blog by</p>

<pre><code>{% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}
</code></pre>

<p>Actually I have 5 categories (catA, catB, catC, catD, catE) at one level, but now I have another category Nr. 6. (catF)
All 5 categories are shown at the blogpage, but catF sound just shown at an separate page (pageF).</p>

<p>I did not find a way to hide all entries from catF at the blogpage and just show these entries at pageF.</p>

<p>Thy four your help.
smueller</p>

<categories>
hide section entries from one section
# hide section entries from one section

(Asked by: username_0 on 2017-10-22)

I’m new at Craft CMS and I hope someone of you could help me a little.
At the moment I get all entries from my blog by
{% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}

Actually I have 5 categories (catA, catB, catC, catD, catE) at one level, but now I have another category Nr. 6. (catF)
All 5 categories are shown at the blogpage, but catF sound just shown at an separate page (pageF).
I did not find a way to hide all entries from catF at the blogpage and just show these entries at pageF.
Thy four your help.
smueller

**Tags:** categories


---

## 1 answers

### Answer by username_1 on 2017-10-23. Score: 4 | Accepted answer

New Answer based on our discussion:

{% set category = craft.categories.id(108).first() %}



{% set entriesInCategory = craft.entries.relatedTo(category).ids() %}


{% set entries = craft.entries.section('blogItem').id('and, not ' ~ entriesInCategory|join(', not ')) %}


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


old Post
You can grab all entries that are related to category F and exclude them in your query
{% set catF = craft.categories.group('categories').ids() %}
{% set entriesForCatF = craft.entries({
    relatedTo: catF,
}).ids() %}

{% set entriesNotInCategoryF = craft.entries.section('blogItem').id('and, not ' ~ entriesForCatF |join(', not ')).ids() %}


{% paginate craft.entries.section('blogItem').limit(globalSettings.postsPerPage).id('and, not ' ~ entriesNotInCategoryF |join(', not ')) as pageActive, pageEntrys %}

> **Comments:**
> **username_0**: Hey, thx for your help. i changed each "CategoryF" and "CatF" by the real category name and i changed the "categories" in categories.group. "blogItem" could stay. But it wount work for me. All i get is a clear div, without blogitems or errors.  
> **username_1**: can you debug every variable and tell me whats in there? just use `{{dump(variableName)}}` Because for me the code works  
> **username_0**: Hope that will help:  `{{ dump(catF) }} array(5) { [0]=> string(1) "4" [1]=> string(1) "5" [2]=> string(1) "6" [3]=> string(1) "7" [4]=> string(2) "36" }`  ` {{ dump(entriesForCatF) }} array(5) { [0]=> string(2) "37" [1]=> string(2) "13" [2]=> string(2) "10" [3]=> string(2) "11" [4]=> string(1) "9" }`  
> **username_0**: `{{ dump(entriesNotInCategoryF) }} object(Craft\ElementCriteriaModel)#196 (17) { ["strictAttributes":protected]=> bool(false) ["_elementType":"Craft\ElementCriteriaModel":private]=> object(Craft\EntryElementType)#146 (7) { ["componentType":protected]=> string(11) "ElementType" ["_sourcesByContext":"Craft\BaseElementType":private]=> NULL ["_classHandle":"Craft\BaseComponentType":private]=> NULL ["behaviors"]=> array(0) { } ["_initialized":"CApplicationComponent"  I had to shorte this: too long by 7303 characters  
> **username_0**: I tried and testet some more time to use your code, but i cant find the position where i have to set the name or the id of the "hidden category", called catF in my example.  CatF: shows all ids from all categories entriesForCatF: shows all Ids from all entries entriesNotInCategoryF: shows 'array(0) { } '  
> **username_1**: Did you link all your entries with the categoryF? I don't know your structure. catF should display all rows in this category. If entriesForCatF display all id's you have an error in your structure since you must have linked every entry with these entries in some way or another.  
> **username_0**: All categories (catA, ... , catF) are at the same level. I use no higher levels and no sublevels  for testing, some of them have an entry. catF is filled with one entry  
> **username_1**: Do you really have 6 different categories or do you have 1 category with 6 entries?  
> **username_0**: All in all 5 categroies, inkl.the special  "catF" and for Testing 5 Entries through all categories. Later there will be a lott more entries, but for testing it is enough.  
> **username_1**: Maybe you could update the handles of your categories, I'll create the same structure and update my post.  
> **username_0**: My categories are: mietobjekte, kaufobjekte, gewerbeobjekte, anlageobjekte, Referenzen. categorie-group-handle: immoCatGroup The section-handle is: immoItem Items from the first 4 categories will displayed at the Blog-page or at their categorie-page. Items from "Referenzen" will just displayed at the Referenzen-Page From time to time an item from one of the first 4 categories is taken to the  Referenzen-Page.  At the Moment i collect the Items by  '{% paginate craft.entries.section('immoItem').limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}'  But this shows all Items  
> **username_1**: So you have one category with 6 different entries and not 6 different categories. Of course you'll fetch them all since I loop through every item in each category. I'll update my code tomorrow ~8am. Since we are both German it's the same time for you  
> **username_0**: No, 1 Group, 5 Categories:  1. mietobjekte, 2. kaufobjekte, 3. gewerbeobjekte, 4. anlageobjekte, 5. Referenzen. If i visite the categoriy "kaufobjekte" i will just see the objects in this category. Each item can just have one category in my case.  Danke vorab für Deine unermüdliche Hilfe bei dem Versuch mir die Funktion der Kategorien in Craft bei zu biegen :-)  
> **username_0**: ok. Thanks for your Help. It did what it should, but when i throw the result in the paginate tag, the pagination woun't work.       '{% paginate entries.limit(globalSettings.postsPerPage) as pageActive, pageEntrys %}     {% for entry in pageEntrys %}         {{ entry.title }}<br>     {% endfor %}'  Is it possible to make the pagination work?  
> **username_0**: Ok. Thanks for all helping hands.  I put the wrong array in the pagination region. It looks like I have a working version :-)  

---

