Title: Custom fields on index.php
Last modified: August 19, 2016

---

# Custom fields on index.php

 *  [m165](https://wordpress.org/support/users/m165/)
 * (@m165)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/custom-fields-on-indexphp/)
 * I’m tying to use WP as a CMS system as well as a blog for a “Projects” section.
   I have a static front page, and it is set up like this:
 * Front page displays: A static page
    Front page: Home Posts page: Latest Projects
 * Home is using a file called “template_home.php”, and the posts page for Latest
   Projects is using “index.php”
 * When editing a page, I have a custom field used for a description of the page.
   Too pull this data in, I use this code on both pages, in exactly the same place:
 *     ```
       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       <?php the_meta(); ?>
       <?php endwhile; endif; ?>
       ```
   
 * This works perfectly for “template_home.php”, but for “index.php” the custom 
   field content will not show up.
 * To clarify, “template_home.php” and “index.php” have the code above in exactly
   the same place, and there are only minor differences between “index.php” and “
   template_home.php”.
 * Is there something I am missing to why it wont work on the page with the blog
   posts?
 * Thanks.

Viewing 1 replies (of 1 total)

 *  [format6](https://wordpress.org/support/users/format6/)
 * (@format6)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-on-indexphp/#post-1458494)
 * I think I have the exact same problem.
    Im using custom fields to add a picture
   to each page like so: <`img class="header_img" src="<?php echo get_post_meta(
   $post->ID, "header_image", true); ?>">`
 * Which is cool on normal pages (home is static) but on my news page(index.php)
   it seems the custom field info is pulled from the **posts**
 * I have created a news page, how can I pull from the custom field of this page
   not the posts on the actual index page?

Viewing 1 replies (of 1 total)

The topic ‘Custom fields on index.php’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [index.php](https://wordpress.org/support/topic-tag/index-php/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [the_meta()](https://wordpress.org/support/topic-tag/the_meta/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [format6](https://wordpress.org/support/users/format6/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-on-indexphp/#post-1458494)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
