custom fields help

Discussion in 'WordPress' started by sixrfan, Mar 5, 2011.

  1. #1
    on the post editor page for this post, 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

    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

    Then, in the body of the page editor for this 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-->
    PHP:
    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!
     
    sixrfan, Mar 5, 2011 IP
  2. sixrfan

    sixrfan Well-Known Member

    Messages:
    354
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    i figured it out. just had the incorrect category name...
     
    sixrfan, Mar 6, 2011 IP