Support » Fixing WordPress » How do I show a custom field meta without the key’s name?

  • I set-up a Custom Field with name=map and value=Google map embed code

    I went to my single post theme template and added the code
    <?php the_meta(); ?>

    In the post I get the Google Map to display properly but to the left of the map it displays ‘map:’

    Without the quotes of course. How do I get the custom field (in this case the Google Map) to display without they name key showing?

    I know I could just paste the embedded Google Map code directly into the post but if the editing window is switched to Visual it usually messes up the Google Map code.

    I figure this should be an easy one for those familiar with php out there (me not).

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi

    (@esmi)

    Forum Moderator

    I had gone to that page, that’s how I got the original <?php the_meta(); ?> code.

    After some digging and trial and error I was able to answer my own question (notice I had said I’m not a php whiz). If someone thinks there’s a better way let me know. All I know now is that this solution works so far.

    I used this code in my theme template and it seems to be okay.
    <?php $key=”map”; echo get_post_meta($post->ID, $key, true); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I show a custom field meta without the key’s name?’ is closed to new replies.