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:^(