Viewing 1 replies (of 1 total)
  • Thread Starter pherank

    (@pherank)

    Something like:

    <?php
    $img_url = '';
    if (is_page('history')) {
      $img_url = 'http://localhost:8888/wp-content/uploads/2013/07/history_img.jpg';
    } elseif (is_page('vineyards')) {
      $img_url = 'http://localhost:8888/wp-content/uploads/2013/07/vineyards_img.jpg';
    } elseif (is_page('wine')) {
      $img_url = 'http://localhost:8888/wp-content/uploads/2013/07/wine_img.jpg';
    } elseif (is_page('contact')) {
      $img_url = 'http://localhost:8888/wp-content/uploads/2013/07/contact_img.jpg';
    } ?>
    
    <div id="page-image"><?php if($img_url) { $img_url } ?></div>

    Or like this?

    <div id="page-image"><?php if (!empty($img_url) { echo $img_url } ?></div>

Viewing 1 replies (of 1 total)

The topic ‘PHP conditional for page-image DIV in page.php’ is closed to new replies.