i've got a private page which has a number of custom fields. what let me do is have the ability to uncover the number of of those fields are filled after which populate a sidebar in line with the items in the fields. i've got a block of code that actually works, however it always searches for individuals four fields particularly and when there is nothing inside, it is simply shows a clear block.

here's the code i am attempting to condense making wiser:

    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158, 'sponsor_01_uri', true); ?>" title="<?php echo get_post_meta(158, 'sponsor_01_uriTitle', true); ?>">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/<?php echo get_post_meta(158, 'sponsor_01_image', true); ?>">
        </a>
    </li>       
    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158, 'sponsor_02_uri', true); ?>" title="<?php echo get_post_meta(158, 'sponsor_02_uriTitle', true); ?>">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/<?php echo get_post_meta(158, 'sponsor_02_image', true); ?>">
        </a>
    </li>       
    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158, 'sponsor_03_uri', true); ?>" title="<?php echo get_post_meta(158, 'sponsor_03_uriTitle', true); ?>">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/<?php echo get_post_meta(158, 'sponsor_03_image', true); ?>">
        </a>
    </li>       
    <li class="sponsorSlot">
        <a href="<?php echo get_post_meta(158, 'sponsor_04_uri', true); ?>" title="<?php echo get_post_meta(158, 'sponsor_04_uriTitle', true); ?>">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/<?php echo get_post_meta(158, 'sponsor_04_image', true); ?>">
        </a>
    </li>   

you will see what i am attempting to do. it might be nice whether it did not matter if there have been 1 or 8 records, it might populate that which was there without needing to clearly specify. my ideas would build an assortment after which just step with the array to construct the sun and rain i want.

thanks all!

WR!

you can easily add an if condition to determine the information on the custom area .

Something similar to

<?php  if((get_post_meta(158, "sponsor_01_uri", true)) || (get_post_meta($post->ID, "sponsor_01_uriTitle", true))) { ?>

yeah you are able to loop with the values came back by get_publish_meta(), but according to documentation automatically it returns a range of all values from the key you specify, but you're overriding it by indicating $single to FALSE.