Support » Themes and Templates » Display only the value from the Custom Field

  • Hi friends,

    I am working on a project in WordPress 3.1.4.

    On different pages in WordPress, I have added 1 Custom Field.

    For pages, I want to display only the value from the custom fields.

    I am using <?php the_meta(); ?> function in my theme file, but the name and value both are displayed.

    Please may I know how to display only the value from the custom field?

    Any help will be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    Hi Alchmyth,

    I did review of get_post_meta().

    When using get_post_meta(), no output was displayed. Hence I used the_meta().

    Any help will be appreciated.

    I think get_post_meta(); does what you want. You might not call it properly. Here is an example:
    echo get_post_meta( get_the_ID(), 'your_key', true );

    Hi gidd,

    Thank for the reply.

    Sorry did not reply earlier.

    I am adding the get_post_meta(), in loop-page.php. Is that rite?

    I am still not receiving any output?

    Any help will be appreciated…

    I don’t know how your theme is structured. Usually, it is page.php. You might put the code in a location where get_the_ID() cannot read the page ID.

    You can test this by replacing get_the_ID() with the real page ID from WordPress admin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display only the value from the Custom Field’ is closed to new replies.