title: Issues in Displaying Metabox in Wordpress
body: <p>I've got the following code, everything saves properly but I cannot get it to display properly on the homepage of the website.</p>
  
  <p>The problem is it <em>displays doubled</em> on the post page and <em>shows up in a random place</em> on the homepage. However I want it to only display on a certain place on the home page.</p>
  
  <pre><code>function home_page_position_get_meta( $value ) {
      global $post;
  
      $field = get_post_meta( $post-&gt;ID, $value, true );
      if ( ! empty( $field ) ) {
          return is_array( $field ) ? stripslashes_deep( $field ) : stripslashes( wp_kses_decode_entities( $field ) );
      } else {
          return false;
      }
  }
  
  function home_page_position_add_meta_box() {
      add_meta_box(
          'home_page_position-home-page-position',
          __( 'Home Page Position', 'home_page_position' ),
          'home_page_position_home_page_position_html',
          'post',
          'side',
          'default'
      );
  }
  add_action( 'add_meta_boxes', 'home_page_position_add_meta_box' );
  
  
  function home_page_position_home_page_position_html( $post) {
      wp_nonce_field( '_home_page_position_home_page_position_nonce', 'home_page_position_home_page_position_nonce' ); 
      $home_page_position_home_page_position_box_position_value =  get_post_meta($post-&gt;ID,'home_page_position_home_page_position_box_position',true);
  ?&gt;
  
      &lt;p&gt;
          &lt;label for="home_page_position_home_page_position_box_position"&gt;&lt;?php _e( 'Box Position', 'home_page_position' ); ?&gt;&lt;/label&gt;&lt;br&gt;
          &lt;select name="home_page_position_home_page_position_box_position"&gt;
  
              &lt;option id='none-none' value='none' name='none_' &lt;?php selected($home_page_position_home_page_position_box_position_value, 'none'); ?&gt; &gt;None&lt;/option&gt;
              &lt;option id='box-01' value='box01' name='box_01' &lt;?php selected($home_page_position_home_page_position_box_position_value, 'box01'); ?&gt; &gt;Box 01&lt;/option&gt;
              &lt;option id='box-02' value='box02' name='box_02' &lt;?php selected($home_page_position_home_page_position_box_position_value, 'box02'); ?&gt; &gt;Box 02&lt;/option&gt;
              &lt;option id='box-03' value='box03' name='box_03' &lt;?php selected($home_page_position_home_page_position_box_position_value, 'box03'); ?&gt; &gt;Box 03&lt;/option&gt;
  
          &lt;/select&gt;
      &lt;/p&gt;    &lt;p&gt;
  
          &lt;label for="home_page_position_home_page_position_page_title"&gt;&lt;?php _e( 'Page Title', 'home_page_position' ); ?&gt;&lt;/label&gt;&lt;br&gt;
          &lt;input type="text" name="home_page_position_home_page_position_page_title" id="home_page_position_home_page_position_page_title" value="&lt;?php echo home_page_position_get_meta( 'home_page_position_home_page_position_page_title' ); ?&gt;"&gt;
      &lt;/p&gt;    &lt;p&gt;
  
          &lt;label for="home_page_position_home_page_position_introduction"&gt;&lt;?php _e( 'Introduction', 'home_page_position' ); ?&gt;&lt;/label&gt;&lt;br&gt;
          &lt;textarea name="home_page_position_home_page_position_introduction" id="home_page_position_home_page_position_introduction" &gt;&lt;?php echo home_page_position_get_meta( 'home_page_position_home_page_position_introduction' ); ?&gt;&lt;/textarea&gt;
  
      &lt;/p&gt;    &lt;p&gt;
  
          &lt;label for="home_page_position_home_page_position_link_to_page"&gt;&lt;?php _e( 'Link To Page', 'home_page_position' ); ?&gt;&lt;/label&gt;&lt;br&gt;
          &lt;input type="text" name="home_page_position_home_page_position_link_to_page" id="home_page_position_home_page_position_link_to_page" value="&lt;?php echo home_page_position_get_meta( 'home_page_position_home_page_position_link_to_page' ); ?&gt;"&gt;
      &lt;/p&gt;&lt;?php
  }
  
  
  function home_page_position_home_page_position_save( $post_id ) {
      if ( defined( 'DOING_AUTOSAVE' ) &amp;&amp; DOING_AUTOSAVE ) return;
      if ( ! isset( $_POST['home_page_position_home_page_position_nonce'] ) || ! wp_verify_nonce( $_POST['home_page_position_home_page_position_nonce'], '_home_page_position_home_page_position_nonce' ) ) return;
      if ( ! current_user_can( 'edit_post' ) ) return;
  
      if ( isset( $_POST['home_page_position_home_page_position_box_position'] ) )
          update_post_meta( $post_id, 'home_page_position_home_page_position_box_position', esc_attr( $_POST['home_page_position_home_page_position_box_position'] ) );
  
      if ( isset( $_POST['home_page_position_home_page_position_page_title'] ) )
          update_post_meta( $post_id, 'home_page_position_home_page_position_page_title', esc_attr( $_POST['home_page_position_home_page_position_page_title'] ) );
  
      if ( isset( $_POST['home_page_position_home_page_position_introduction'] ) )
          update_post_meta( $post_id, 'home_page_position_home_page_position_introduction', esc_attr( $_POST['home_page_position_home_page_position_introduction'] ) );
  
      if ( isset( $_POST['home_page_position_home_page_position_link_to_page'] ) )
          update_post_meta( $post_id, 'home_page_position_home_page_position_link_to_page', esc_attr( $_POST['home_page_position_home_page_position_link_to_page'] ) );
  }
  add_action( 'save_post', 'home_page_position_home_page_position_save' );
  
  
  function cd_display_quote( $value )
  {
       // We're in the loop, so we can grab the $post variable
      global $post;
  
      $position = get_post_meta( $post-&gt;ID, 'home_page_position_home_page_position_box_position', true );
      $pTitle = get_post_meta( $post-&gt;ID, 'home_page_position_home_page_position_page_title', true );
      $intro = get_post_meta( $post-&gt;ID, 'home_page_position_home_page_position_introduction', true );
      $link = get_post_meta( $post-&gt;ID, 'home_page_position_home_page_position_link_to_page', true );  
  
      if( $position != 'none' ) {
          echo $position;
          echo $pTitle;
          echo $intro;
          echo $link;        
      }
  
  
      // Return the values: quote first, then the content
      return $value;
  }
  add_action('the_content', 'cd_display_quote');
  </code></pre>