Answers.Body: <p>Here are a couple of useful stackexchange questions</p>
  
  <ul>
  <li>Getting a random entry: <a href="https://craftcms.stackexchange.com/questions/2675/section-entries-order-by-random">Section entries - order by random</a></li>
  <li>Excluding the current entry: <a href="https://craftcms.stackexchange.com/questions/1275/exclude-current-entry/">Exclude Current Entry</a></li>
  </ul>
  
  <p>Putting that together:</p>
  
  <pre><code>{% set randomEntry = craft.entries({
    id: 'not '~entry.id,
    order: 'RAND()'
  }).first %}
  </code></pre>
  
  <p>This will fetch entries whose id is not <code>entry.id</code> (<code>entry</code> is the current entry), ordered randomly, and then give you the first of those.</p>
  
  <p>Probably you want to specify the section or sections to fetch your entries from:</p>
  
  <pre><code>{% set randomEntry = craft.entries({
    section: ['thisSection', 'thatSection', 'theOtherSection'],
    id: 'not '~entry.id,
    order: 'RAND()'
  }).first %}
  </code></pre>
  
  <p>This will do the same thing, but only fetch entries from those 3 sections.</p>
  
  <p>After all of that, you should also be sure to test that there actually is an entry:</p>
  
  <pre><code>{% if randomEntry %}
    ... do your thing ...
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-26T03:54:45.130Z
Answers.Text: Awesome thank! I got most the way there using other threads but couldn't figure out how to add the " id: 'not '~entry.id " to what I had:
   {% set randomEntry = craft.entries.section('projects').order('RAND()').first() %}
Answers.UserDisplayName: leham789
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-26T01:28:42.080Z
Answers.LastActivityDate: 2017-02-26T01:28:42.080Z
Answers.LastEditDate: 2017-04-13T12:51:00.303Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I am brand new to Craft and can't find much support on this problem online. I have my entry pages and at the bottom of them, I have a div with the code below in it which randomly links to any entry.</p>
  
  <p>I now would like this to disallow the entry that I am on from that randomization. I assume from other threads it would be something to do with finding the ID of the entry the user is on and not allowing it in the randomize?</p>
  
  <pre><code>{% for image in randomEntry.projectFeaturedImage %}
  
      &lt;a href="{{ randomEntry.url }}"&gt;{{ randomEntry.title }}&lt;/a&gt;
      &lt;a href="{{ randomEntry.url }}"&gt;See Project&lt;/a&gt;
  
  {% endfor %}
  </code></pre>
  
Tags: <entry><random>
Title: Random posts displayed but exclude current entry ID
ThreadText: # Random posts displayed but exclude current entry ID
  
  (Asked by: username_0 on 2017-02-25)
  
  I am brand new to Craft and can't find much support on this problem online. I have my entry pages and at the bottom of them, I have a div with the code below in it which randomly links to any entry.
  
  I now would like this to disallow the entry that I am on from that randomization. I assume from other threads it would be something to do with finding the ID of the entry the user is on and not allowing it in the randomize?
  
  ```
  {% for image in randomEntry.projectFeaturedImage %}
  
      <a href="{{ randomEntry.url }}">{{ randomEntry.title }}</a>
      <a href="{{ randomEntry.url }}">See Project</a>
  
  {% endfor %}
  
  ```
  
  **Tags:** entry, random
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-02-26. Score: 2 | Accepted answer
  
  Here are a couple of useful stackexchange questions
  
  * Getting a random entry: [Section entries - order by random](https://craftcms.stackexchange.com/questions/2675/section-entries-order-by-random)
  * Excluding the current entry: [Exclude Current Entry](https://craftcms.stackexchange.com/questions/1275/exclude-current-entry/)
  
  Putting that together:
  
  ```
  {% set randomEntry = craft.entries({
    id: 'not '~entry.id,
    order: 'RAND()'
  }).first %}
  
  ```
  
  This will fetch entries whose id is not `entry.id` (`entry` is the current entry), ordered randomly, and then give you the first of those.
  
  Probably you want to specify the section or sections to fetch your entries from:
  
  ```
  {% set randomEntry = craft.entries({
    section: ['thisSection', 'thatSection', 'theOtherSection'],
    id: 'not '~entry.id,
    order: 'RAND()'
  }).first %}
  
  ```
  
  This will do the same thing, but only fetch entries from those 3 sections.
  
  After all of that, you should also be sure to test that there actually is an entry:
  
  ```
  {% if randomEntry %}
    ... do your thing ...
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Awesome thank! I got most the way there using other threads but couldn't figure out how to add the " id: 'not '~entry.id " to what I had:  {% set randomEntry = craft.entries.section('projects').order('RAND()').first() %}  
  
  ---
  
  