• I am a noob. I know very little about PHP.

    I want to display a unique picture per page using custom fields.

    I’ve modified the FallSeason 1.0 template intending to display a unique picture for each page in the sidebar div. I have the image I want to use in the theme’s image folder.

    With success, I’ve used <?php the_meta(); ?> to display the meta data for my image. Very Cool.

    I’ve picked another piece of code from another discussion and am only able to display an image place-holder. Here’s the code…

    <div id=”sidebar”>
    <img src=”https://www.breschcraft.com/gorges/wp-content/themes/fallseason-10/images
    <?php $values = get_post_custom_values(“sidebar_page_img”); echo $values[0]; ?>.jpg”>
    </div>

    I’m closer than ever, but I need your help!
    Will you accept this challenge?

    Thanks very much.

Viewing 1 replies (of 1 total)
  • I’m having the same problem. I was doing it slightly differently, we are both doing the same thing where we are trying to replace the name of an image with a php result.

    <?php
    $pagepic = bloginfo ( 'stylesheet_directory' ).'/images/';
    
    if (is_page('us')) $pagepic .= 'us.png';
    
     ?>
    
    <img src="<?php echo $pagepic; ?>" alt="us" width="208px" height="160px" />

    But, it is NOT working. First it echos my stylesheet directory and then it prints the alt tag of the image.

    Anyway, If someone can solve tbresch’s problem, I’ll happily use that solution. Anyone out there?

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Fields to display a unique picture per page.’ is closed to new replies.