WordPress.org

Ready to get started?Download WordPress

Forums

Query the author (1 post)

  1. basho
    Member
    Posted 5 years ago #

    Hi everyone,

    I have a bit of code in my template that displays a picture if one has been asigned and displays another if it hasn't. I want to change this code to display a picture if the author is "cescabell" and display another if it isn't

    I have tried looking through the codex, but can't quite figure it out. Can anyone help?

    The code is

    <td valign = top><span>	<?php if ( get_post_meta($post->ID, 'thumb', true) ) { ?> <!-- DISPLAYS THE IMAGE URL SPECIFIED IN THE CUSTOM FIELD -->
    
    				<img src="<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>" alt="" class="th" height="150" width="150"/><BR CLEAR=ALL> 		
    
    			<?php } else { ?> <!-- DISPLAY THE DEFAULT IMAGE, IF CUSTOM FIELD HAS NOT BEEN COMPLETED -->
    
    				<img src="<?php bloginfo('template_directory'); ?>/images/no-img-thumb.jpg" alt="" class="th" height="100" width="100"/><BR CLEAR=ALL> 
    
    			<?php } ?></span>
    </td>

    Many thanks,

    You can see how the current code works on the front page of my site: http://www.outsidecontext.com

    Thanks for reading!

    Basho

Topic Closed

This topic has been closed to new replies.

About this Topic