I have few custom field assigned for each post, like: "Club" with value "club1" "Date" with value "date1" and so on...

Now, I want to display from all the custom fields just those 2 " club" and "date".

This is my markup :

                    <div class="meta-container"><?php the_meta(); ?></div>

The problem with this, is that is retrieving all the custom fields and I don't want this. I was thinking to add css psedoselector like nth:child(n) but I'm sure that I can do this with this function. Thank you!

2 Answers 2


You should use get_post_meta() twice (Ref to your other question):

  echo get_post_meta( get_the_ID(), 'club', true ); 
  echo '<br />';
  echo get_post_meta( get_the_ID(), 'date', true ); 

Oddly enough, one of your tags is exactly what you need! You're looking for WordPress' get_post_meta function: http://codex.wordpress.org/Function_Reference/get_post_meta

Within the loop, it would look something like this:

<?php echo get_post_meta(get_the_ID(), 'Club', true); ?>
  • I've tried also this, but is not working, now it doesn't display anything.
    – agis
    Apr 16, 2013 at 0:03
  • My bad, it was a cache problem, it's working but I can not retrieve two values: I've tried this: <?php echo get_post_meta(get_the_ID(), 'CLUB','DATES', true); ?>
    – agis
    Apr 16, 2013 at 11:30

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.