Title: Single permalink returning one custom post
Last modified: August 22, 2016

---

# Single permalink returning one custom post

 *  [Loki180](https://wordpress.org/support/users/loki180/)
 * (@loki180)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/single-permalink-returning-one-custom-post/)
 * Hello guys, I am having some issues with my wordpress site.
 * When one clicks on a permalink element, WordPress generates a page full of all
   the custom fields.
 * How do I get it to only show the one that I click on? I have tried to get it 
   to work but I am at an impasse.
 * This code is the clickable custom work image field
    <?php
 *  $args = array(
    ‘post_type’ => ‘work’ );
 *  $the_query = new WP_Query($args);
    ?>
 *  <?php if (have_posts() ) : while ( $the_query->have_posts() ) : $the_query->
   the_post(); ?>
 * 
    -  <img class=’image-area’ src='<?php the_field(‘image’); ?>’>
    -  <?php endwhile; ?>
       <?php wp_reset_postdata(); ?> <?php endif; ?>
    - When I click on the image it displays all the work posts not the one that 
      was clicked,
    - I cannot find out how to fix it!
    - Sorry about the code blocks I could not get it!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [K A](https://wordpress.org/support/users/krazza/)
 * (@krazza)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/single-permalink-returning-one-custom-post/#post-5623586)
 * Please use display editor of adding `CODE`, your code is breaking this page.
 *  Thread Starter [Loki180](https://wordpress.org/support/users/loki180/)
 * (@loki180)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/single-permalink-returning-one-custom-post/#post-5623739)
 * Sorry about the above, This one will be better to understand!
 * The blow code is from the
 * single-work.php
 *     ```
       $args = array(
           "post_type" => "work"
         );
   
         $the_query = new WP_Query($args);
       ?>
   
       <?php if (have_posts() ) : while ($the_query->have_posts() ) : $the_query->the_post(); ?>
   
       <h1><?php the_field("name_of_website"); ?></h1>
       <img class="image-area' src="<?php the_field("image"); ?>'>
       <p><?php the_field("description"); ?></p>
   
       <?php endwhile; ?>
       <?php wp_reset_postdata(); ?>
       <?php endif; ?>
       ```
   
 * The below code is from the portfolio of the clickable field image
 *     ```
       <?php
   
                     $args = array(
                       'post_type' => 'work'
                     );
   
                     $the_query = new WP_Query($args);
                   ?>
   
                   <?php if (have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
   
                     <a href='<?php the_permalink(); ?>'>
                       <li>
                         <img class='image-area' src='<?php the_field('image'); ?>'>
                       </li>
                     </a>
   
                   <?php endwhile; ?>
                   <?php wp_reset_postdata(); ?>
                   <?php endif; ?>
       ```
   
 * When I click on the image WordPress displays all the custom posts and fields 
   from Work I want it to only display the one clicked, I can not remember how to
   do it!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Single permalink returning one custom post’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Loki180](https://wordpress.org/support/users/loki180/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/single-permalink-returning-one-custom-post/#post-5623739)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
