I've read a ton of tutorials and articles and searched for days now, but I still can't seem to get my custom fields to display in the loop and I could use a hand.

First off, I definitely have the custom fields enabled and they are taking data. When I edit a post (I'm using the More Fields plugin), I can see the native custom fields boxes on the post, and the data is loading from the database.

I am creating a child theme for Twenty Eleven, which is otherwise working beautifully. When I try to insert the

<?php echo get_post_meta($post->ID, 'details', true); ?> 

code into the loop, i get no response. I'm putting it on the index.php template. 'details' is the name of the custom field key I'm trying to display.

Right now, the pertinent bit of code I'm using is this:

<?php while ( have_posts() ) : the_post(); ?>
                <?php get_template_part( 'content', get_post_format() ); ?>
                <?php echo get_post_meta($post->ID, 'start_time', true); ?>
            <?php endwhile; ?>

Alas, the data is not showing up on the front end. Does anyone have any idea why this isn't working? It seems like such a simple thing and I am a bit confused as to why the Twenty Eleven theme doesn't have something built in to handle custom fields.

I can post other bits of code or whatever if it's needed for further troubleshooting. Thanks in advance!

Just a follow up: I tried putting a basic

<p><?php echo "this is working" ?></p>   

inside the loop and that didn't work either. something is definitely screwy here. i've got the index.php inside the child theme folder, and the posts are definitely posting and displaying on the page. and that bit of code works perfectly if i put it inside the footer.

In case it would help, here's the link to my dev version: http://sandbox.littleoracle.net/starseed/?p=291

  • inside your loop do: <?php var_dump(get_post_custom()); ?> this will show you all custom fields that are set for that post. If you can post your results here to better aid us.
    – Scott
    Commented Aug 2, 2011 at 16:43
  • Weird. Just tried pasting that in and it didn't return anything. Nothing printing to the front end except the usual title and content. It is supposed to go inside the loop on the index.php template, right?
    – jennifer
    Commented Aug 2, 2011 at 17:10
  • You've definitely activated your child theme? It's showing up in your theme choices? Commented Aug 2, 2011 at 17:41
  • Yes, most definitely. It's working quite nicely. I've been able to do everything else I need on this, created and displaying custom post types, and all other kinds of things. The rest of the theme, minus IE testing, is working perfectly. The link is here: sandbox.littleoracle.net/starseed/?p=291
    – jennifer
    Commented Aug 2, 2011 at 17:59

3 Answers 3


Just passing on my solution in case it's of any help to anyone.

I'm still not completely sure what happened, but after disabling all plugins and eventually trying a completely separate, vanilla install on my localhost, I determined that something had gone wrong in the theme files.

I was able to fix the issues by downloading a fresh copy of the Twenty Eleven theme and installing it. The child theme was untouched and working fine.

As soon as I did this, my custom fields appeared without any further problems.


Sorry to repost here - I can't comment yet. Vote me up to 50 and help us both out.

Anyway, looking at your theme, in your stylesheet you are referencing 'Template: twentyten' instead of 'Template:twentyeleven'

Wordpress may be confused about where to look for which files. I would start by correcting that and see what happens.

  • Sorry I can't vote you up yet! My rep is not high enough. I fixed the stylesheet (Thank You!) but it had no effect. I'm going to try a vanilla install and see if I can get it working with no plugins, etc., just to make sure I'm doing it correctly. Time to start from the foundation and troubleshoot my way up.
    – jennifer
    Commented Aug 2, 2011 at 20:49

An update for people who might be looking for a help in this type of problem.

Just add global $post; inside your loop to display your custom fields on frontend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.