title: Using if is_page() Wordpress conditional statement
body: <p>I'm trying to have different pictures on every one of my pages built on wordpress.</p>
  
  <p>So I have the following in my index.php file, archive.php file, page.php file, etc:</p>
  
  <pre><code>&lt;img src="&lt;?php bloginfo('template_url'); ?&gt;/images/&lt;?php echo $toppic; ?&gt;" alt="page1" id="mainPageImg" /&gt;
  </code></pre>
  
  <p>Now, in my page.php file, I have the following:</p>
  
  <pre><code>&lt;?php
      // TOP PICTURE DEFINITIONS
      if ( is_home() ) {
          $toppic == 'page1.png';
      }
      if ( is_page('articles') ) {
          $toppic == 'page2.png';
      }
  ?&gt;
  </code></pre>
  
  <p>How come this does not work? I tried it with one equal (=) sign...</p>
  
  <p>EDIT: If I define $toppic at the top, for example, in the index.php file as follows:</p>
  
  <pre><code>&lt;?php $toppic = 'page1.png'; ?&gt;
  </code></pre>
  
  <p>Then it works. So therefore, it must be something that has to do with the conditional if is_page/is_home statements. Any ideas?</p>
  
  <p>Thanks!
  Amit</p>