• I am having an issue with outputting data from custom post type (cpt) that I can’t seem to solve. I have searched tutorials and the codex for get_post_meta on the subject but can’t make it work. I would be grateful if someone could answer my questions at the bottom or point me to a tutorial.

    Here’s the story. I have created the cpt with a custom meta box using the tutorial seen here: http://wptheming.com/2010/08/custom-metabox-for-post-type/ . The custom post type is made up of the standard title meta box and a custom meta box I created comprised of several text fields. The post type looks like it is created just fine. The post type name and navigation shows up on the left side of the admin menu. I can add a new entry into the post type and I get the correct edit screen. All of the fields in the custom meta box I created in the post type show up correctly on the edit page and I can save and reopen the individual entries and update the data and resave, etc.

    I simply can’t get the data in the custom post type to output in my template the way I want it to. After I enter a new entry as a custom post and click on “view” I only see the post title from the standard title meta box and not any of the data from the various fields of the custom meta box I created. I know the data in those fields of the custom meta box have been saved because I can edit and update those fields and when I do an export all the fields and associated data are listed correctly in the export xml file.

    I know that there must be something obvious that I’m missing but here are my specific questions:

    1) In general, how do you get a custom post type to output in a template including the standard title AND all of the data from the various fields of the custom meta box?

    2) Is there a template tag format for outputting individual fields from a single entry of the custom post type. For example, if the custom post type custom meta box includes a field for “phone number”
    (with the meta name “phone”), is there a way to output “phone” from a specific post number in a template area using a template tag outside of the loop.

  • The topic ‘Output of Custom Post Type fields’ is closed to new replies.