WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason this custom field is not being shown in the page.

This is the template file:


 * Template Name: bbPress - Topics (Newest)
 * @package bbPress
 * @subpackage Theme


<?php get_header(); ?>

        <div id="container">
            <div id="content" role="main">

                <?php do_action( 'bbp_template_notices' ); ?>

                <?php while ( have_posts() ) : the_post(); ?>

                    <div id="topics-front" class="bbp-topics-front">
                        <div class="entry-content">

                            <div id="page-intro">
                                <?php the_content(); ?>

                            <?php get_template_part( 'loop', 'bbp_topics' ); ?>

                    </div><!-- #topics-front -->

                <?php endwhile; ?>

                <?php if ( get_post_meta($post->ID, 'note', true) ) : ?>
                    <div id="note">
                        <p><?php echo get_post_meta($post->ID, 'note', true); ?><p/>
                <?php endif; ?>

            </div><!-- #content -->
        </div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

As you can see everything is set:

enter image description here

share|improve this question
up vote 5 down vote accepted

You're doing it outside of The Loop there, so $post is undefined at that point. Put it above the endwhile and it should work.

share|improve this answer

I have a similar situation and the global $post solution do the trick. :)

share|improve this answer
Main template files are included in global scope, so global $post; is of no use here. – John P Bloch Apr 28 '11 at 19:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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