• Resolved nbatioco

    (@nbatioco)


    Hi I am very new in php and I only knew few php codes and basic of HTML.

    <h1><?php the_title(); ?>'s Trailer Pictures</h1> <br /><br />
    
    <img src="<?php echo get_post_meta($post->ID, 'Oneimg', true); ?>" class="trailer-gallery-img" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" />
    <img src="<?php echo get_post_meta($post->ID, 'Twoimg', true); ?>" class="trailer-gallery-img" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" />
    <img src="<?php echo get_post_meta($post->ID, 'Threeimg', true); ?>" class="trailer-gallery-img" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" />

    Now, I have some post that I may only use one custom field keys for example first post use 3 keys “Oneimg”, “Twoimg” and “Threeimg” then the other post dont use neither of the three keys but it display a x mark or something like a picture is missing.

    Can someone help me with the proper php code which if I have a post the
    <h1><?php the_title(); ?>’s Trailer Pictures</h1>

    will display including the pictures and if I dont use the code it wont shown up.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Fields – Image If else’ is closed to new replies.