• Hi all,

    I’m using custom fields on the WP site below to indicate the image for the page background and the 3 images used in the masthead. I figured out how to add the php for use on pages, but it’s not working on the index/blog page. Can anyone help me out?

    Here is the site: snorkel.jerryrossphotography.com

    Here is the code I’m using in header.php

    <body <?php body_class(); ?>>
    
            <?php $backgroundPath = get_post_meta($post->ID, 'Background', true);?>
    
            <img class="bg" src="<?php bloginfo ('template_url'); ?>/images/<?php echo $backgroundPath ?>" border="0">
    
                    <div id="page-wrap">
    
                            <header>
    
                                    <div id="logo">
                                            <a href="http://snorkel.jerryrossphotography.com/" title="Logo for Coral Reef Divers, Kailua-Kona, Hawaii"><img src="<?php bloginfo ('template_url'); ?>/images/logo-coral-reef-divers.png" alt="Link to Home Page of Coral Reef Divers, Kailua-Kona, Hawaii" border="0"></a>
                                    </div>
    
                                    <?php $MastheadImage01Path = get_post_meta($post->ID, 'Masthead-Image-01', true);?>
                                    <?php $MastheadImage02Path = get_post_meta($post->ID, 'Masthead-Image-02', true);?>
                                    <?php $MastheadImage03Path = get_post_meta($post->ID, 'Masthead-Image-03', true);?>
                                    <?php $MastheadThumb01Path = get_post_meta($post->ID, 'Masthead-Thumb-01', true);?>
                                    <?php $MastheadThumb02Path = get_post_meta($post->ID, 'Masthead-Thumb-02', true);?>
                                    <?php $MastheadThumb03Path = get_post_meta($post->ID, 'Masthead-Thumb-03', true);?>
    
                                    <div class="span-24 column rounded">
                                            <div class="span-6 column rotated">
                                                    <a id="image1" class="cms-editable polaroid" href="#pic-1" rel="lightbox" title="first image" width="250px"><img src="<?php bloginfo ('template_url'); ?>/images/<?php echo $MastheadThumb03Path ?>" alt="image" /></a>
                                            </div>
                                            <div class="span-6 column rotated">
                                                    <a id="image2" class="cms-editable polaroid" href="#pic-2" rel="lightbox" title="second image" width="250px"><img src="<?php bloginfo ('template_url'); ?>/images/<?php echo $MastheadThumb02Path ?>" alt="image" /></a>
                                            </div>
                                            <div class="span-6 column rotated">
                                                    <a id="image3" class="cms-editable polaroid" href="#pic-3" rel="lightbox" title="third image" width="250px"><img src="<?php bloginfo ('template_url'); ?>/images/<?php echo $MastheadThumb01Path ?>" alt="image" /></a>
                                            </div>
                                    </div>
                                    <div id="pic-1">
                                        <img src="<?php bloginfo ('template_url'); ?>/images/<?php echo $MastheadImage03Path ?>" alt="image" />
                                    </div>
                                    <div id="pic-2">
                                        <img src="<?php bloginfo ('template_url'); ?>/images/<?php echo $MastheadImage02Path ?>" alt="image" />
                                    </div>
                                    <div id="pic-3">
                                        <img src="<?php bloginfo ('template_url'); ?>/images/<?php echo $MastheadImage01Path ?>" alt="image" />
                                    </div>
    
                                    <div class="clear"></div>
                            </header>

  • The topic ‘Need help displaying custom fields on 'blog' or index page’ is closed to new replies.