I am simply trying to print the value of a custom field. I have read all the documentation, tried out other people's suggestions, and nothing works. I can get it to print the ID #, but not the actual value I have in the field. I am using the Types plugin to create the field.
this prints the ID:
<?php echo get_the_ID($value, 'authorinfo', true); ?>
as well as:
<?php echo get_the_ID($key, 'authorinfo', true); ?>
this does nothing:
<?php get_post_meta( $post->ID, 'authorinfo', true ); ?>
this does nothing:
<?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?>
(I have a separate question on this site where the problem came up and a solution was offered but unfortunately it didn't work for me) - Display custom post type and custom fields within a Bootstrap Carousel
Here is all the code I'm working within in case that helps. I hope I'm doing something stupid here.
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="myCarousel" class="carousel">
<div class="carousel-inner">
<?php $the_query = new WP_Query(array(
'post_type' => 'testimonial',
'posts_per_page' => 1
));
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="item active" data-title="">
<div class="slide-copy">
<?php the_content();?>
<span class="byline"><?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?></span>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
<?php $the_query = new WP_Query(array(
'post_type' => 'testimonial',
'posts_per_page' => 5,
'offset' => 1
));
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="item" data-title="">
<div class="slide-copy">
<?php the_content();?>
<span class="byline"><?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?></span>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
</div>
</div>
</div><!-- end myCarousel -->
<?php endwhile; ?>
EDIT/ADDITION
Since working with the Types plugin more, I am pretty sure this problem could be solved by using "types_render_field" instead of "get_post_meta". I don't have a place where I can test this, but I think this should help someone with a similar problem.

<?php echo get_post_meta(get_the_ID(), 'authorinfo', true); ?>is correct. If it's not working, it might have something to do with how your plugin saves the data. Can't say further as i'm unfamiliar with that plugin – Mridul Aggarwal Nov 12 '12 at 20:37