Answers.Body: <p>Is this the best way to do it?</p>
  
  <pre><code>`{% set results = craft.entries.section(posts).search('countryName:"United Kingdom"') %}
  </code></pre>
  
  <p>It appears to work.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-06T19:03:48.377Z
Answers.LastActivityDate: 2017-03-06T19:03:48.377Z
Answers.UserDisplayName: Hellyar
Answers.Body: <p><code>{% set entries = craft.entries.section('posts').countryName('United Kingdom') %}</code> should do the trick</p>
  
  <p>EDIT: 
  <code>{% set results = craft.entries.section('posts').relatedTo('United Kingdom').find() %}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-06T18:40:21.967Z
Answers.Text: It does not.  It does not cause an error.  But nothing is written.  And everything appears when I remove the appended `.countryName('United Kingdom').  And, I double checked the field name and I tried multiple country names.
Answers.UserDisplayName: Hellyar
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-06T19:44:40.147Z
Answers.Text: Sorry, I misread. I didn't realize the country name was also a category. Would `{% set results = craft.entries.section('posts').relatedTo('United Kingdom').find() %}`
   work?
Answers.UserDisplayName: strandall
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-06T18:30:13.113Z
Answers.LastActivityDate: 2017-05-17T14:22:15.883Z
Answers.LastEditDate: 2017-05-17T14:22:15.883Z
Answers.UserDisplayName: strandall
Body: <p>Help, I forgot how to do something basic. </p>
  
  <p>How do I pull all the entries in <code>posts</code> for a specific category value (field name = <code>countryName</code>) within the category group called <code>country</code>?   </p>
  
  <p>And I am <strong><em>NOT</em></strong> using the template for posts or the category.</p>
  
  <p>I can pull all the entries using </p>
  
  <p><code>{% for doc in craft.entries.section('posts') %}</code><br>
  --<em>OR</em>-- </p>
  
  <p><code>{% set entries = craft.entries.section('posts') %}</code></p>
  
  <p>But, I forgot how to now add a second condition to pull up only those entries with the <code>countryName</code> (say) "United Kingdom"?</p>
  
  <p>Thank you. </p>
  
Tags: <templating>
Title: How do you pull entries with a specific category value?
ThreadText: # How do you pull entries with a specific category value?
  
  (Asked by: username_0 on 2017-03-06)
  
  Help, I forgot how to do something basic.
  
  How do I pull all the entries in `posts` for a specific category value (field name = `countryName`) within the category group called `country`?
  
  And I am ***NOT*** using the template for posts or the category.
  
  I can pull all the entries using
  
  `{% for doc in craft.entries.section('posts') %}`  
  --*OR*--
  
  `{% set entries = craft.entries.section('posts') %}`
  
  But, I forgot how to now add a second condition to pull up only those entries with the `countryName` (say) "United Kingdom"?
  
  Thank you.
  
  **Tags:** templating
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-03-06. Score: 1
  
  Is this the best way to do it?
  
  ```
  `{% set results = craft.entries.section(posts).search('countryName:"United Kingdom"') %}
  
  ```
  
  It appears to work.
  
  
  ---
  
  ### Answer by username_1 on 2017-03-06. Score: 0
  
  `{% set entries = craft.entries.section('posts').countryName('United Kingdom') %}` should do the trick
  
  EDIT:
  `{% set results = craft.entries.section('posts').relatedTo('United Kingdom').find() %}`
  
  > **Comments:**
  > **username_0**: It does not.  It does not cause an error.  But nothing is written.  And everything appears when I remove the appended `.countryName('United Kingdom').  And, I double checked the field name and I tried multiple country names.  
  > **username_1**: Sorry, I misread. I didn't realize the country name was also a category. Would `{% set results = craft.entries.section('posts').relatedTo('United Kingdom').find() %}`  work?  
  
  ---
  
  