Title: custom fields help
Last modified: August 19, 2016

---

# custom fields help

 *  Resolved [goldmember](https://wordpress.org/support/users/goldmember/)
 * (@goldmember)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-help-4/)
 * on the post editor page for [this post](http://shirtsaboutnothing.com/wordpress/test-post-1/),
   I added a custom field where
    CUSTOM FIELD NAME= portfolio-image CUSTOM FIELD
   VALUE= [http://www.shirtsaboutnothing.com/wordpress/wp-content/uploads/site-elements/test1-sml.jpg](http://www.shirtsaboutnothing.com/wordpress/wp-content/uploads/site-elements/test1-sml.jpg)
 * and on another post, I have similar values:
    CUSTOM FIELD NAME= portfolio-image
   CUSTOM FIELD VALUE= [http://www.shirtsaboutnothing.com/wordpress/wp-content/uploads/site-elements/test2-sml.jpg](http://www.shirtsaboutnothing.com/wordpress/wp-content/uploads/site-elements/test2-sml.jpg)
 * Then, in the body of the page editor for [this page](http://shirtsaboutnothing.com/wordpress/sample-page/)
   i have the following code towards the bottom, which I thought would spit out 
   those images that i entered in the posts custom fields.
 *     ```
       <h5>Recent Projects</h5>
               <div id="recent-projects">
       		<?php
                   $count = 0;
                   $recentblog = new WP_Query();
                   $recentblog->query("showposts=3&category_name=Portfolio");
                   while($recentblog->have_posts()) : $recentblog->the_post()
               ?>
               <?php
               if($count==0) {
                       $count++;
               ?>
               <div class="frontpage-project-box-1">
                       <a href="<?php the_permalink(); ?>"><img src="<?php $thumb = get_post_custom_values('portfolio-image'); echo $thumb[0]; ?>" alt="<?php the_title(); ?>" />
                       <h4><?php the_title(); ?></h4></a>
                   </div>
               <?php
                   } else {
               ?>
               <div class="frontpage-project-box">
                       <a href="<?php the_permalink(); ?>"><img src="<?php $thumb = get_post_custom_values('portfolio-image'); echo $thumb[0]; ?>" alt="<?php the_title(); ?>" />
                       <h4><?php the_title(); ?></h4></a>
                   </div>
               <?php
                   }
                   endwhile;
               ?>
           	</div><!--end recent-projects-->
       ```
   
 * but for some reason, as you can see, it is not spitting out the images on this
   page. I’m using the exec-php plugin so putting php code in my page editor should
   work.
 * please advise what’s wrong. thanks!

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

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-help-4/#post-1957355)
 * From what I can see, I think that your query for category_name=Portfolio is not
   finding any posts. Your code is being executed because the div with id=’recent-
   projects’ is being created.
 *  Thread Starter [goldmember](https://wordpress.org/support/users/goldmember/)
 * (@goldmember)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-help-4/#post-1957429)
 * oh. duh. thank you!!!

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

The topic ‘custom fields help’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [goldmember](https://wordpress.org/support/users/goldmember/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-help-4/#post-1957429)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
