WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] Calling custom fields from a specific pod item (7 posts)

  1. Olly - OWMC
    Member
    Posted 1 year ago #

    I want to call a specific item in a pod. That item has a few fields which I also want to call.

    I have tried using this code: http://mondaybynoon.com/20100104/pulling-pods-data/

    But the problem with this is that it calls all the items in the pod. I only want to call 1 specific pod item. Which shouldn't require so much code. I am able to call the pod item with this typical wordpress post query: http://pastebin.com/N1YM7HK6.

    However I don't seem to be able to call any of the pod item's fields. I assume this is because Pods use different fields which aren't compatible with wordpress post queries.

    Either way, is there a nice small bit of php that will allow me to do this? Either using the wordpress post query i linked to above or a pod query similar (but shorter) to the one from Monday By Noon.

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    We use the WordPress standard for all of our fields, try using:

    $field_value = get_post_meta( $queried_post->ID, 'field_name', true );

  3. Olly - OWMC
    Member
    Posted 1 year ago #

    Ah! i see. I've just tried that quickly and it didn't work for me.

    <p><?php $position_value = get_post_meta( 56, 'position', true ); ?></p>

    Yet my pod item is 56 and the field i want to call is named "position", so not sure why it's not showing. Do i need to put an echo in there?

    As this is a standard wordpress call, perhaps i should post my question outside of the Pods support forum.

    By the way, I absolutely love Pods to bits. It really allows me to give my clients a super-simple way to manage content. I really feel that Pods should be integrated into WordPress core. You've opened up so many possibilities you're making me think twice about learning Joomla. Brilliant work.

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Awesome and thanks!

    For get_post_meta reference, check this out:

    http://codex.wordpress.org/Function_Reference/get_post_meta

    Yes, it returns a value, so you would need to echo it where you want.

  5. Olly - OWMC
    Member
    Posted 1 year ago #

    got it! nice.

    <?php echo get_post_meta( 56, 'position', true ); ?>

    This topic is resolved.

    :D

  6. codzprc
    Member
    Posted 1 year ago #

    For those looking for how to display User field data, use

    <?php echo get_user_meta( $theuser->ID, 'field_name', true ); ?>

    I found this page, looking for the answer I just posted, so I thought it might help others.

  7. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Also, the same apply for comments too, get_comment_meta

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic