WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] get custom field in admin (7 posts)

  1. Hube2
    Member
    Posted 1 year ago #

    How to I get the value of a custom field in the admin?

    I have created a custom post type that will hold images
    I have created a custom image field for the custom post type
    I would like to show this image in the post list for the custom post type (i.e. on edit.php)

    When I try to call types_render_field on an admin display page to show the image I get:
    Fatal error: Call to undefined function types_render_field() in...

    Is there any way to get the values for the custom fields in the admin area?

    I've tried get_posts to get attachments and setting "meta_key" to the key that is stored in the database "wpcf-custom-image" and I've tried it without the "wpcf-" prefix, neither return anything.

    What am I missing, or is it impossible to do this?

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

  2. mbigul
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Hube2,

    Please include include: embedded/frontend.php. Because function is in frontend.php. That is not included to admin pages, it is only for front end page.

    [ Signature moderated. ]

  3. Hube2
    Member
    Posted 1 year ago #

    Well, that sounds like a pain. Fields should be available in the admin just like the front end. I'm creating a custom post type with custom fields. Why wouldn't I want to customize the rest of the admin to show relevant field columns.

    Thanks anyway

  4. mbigul
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Hube2,

    Sorry this feature is not included now. But you can view the fields in Post edit screens.

    [ Signature moderated. ]

  5. James Revillini
    Member
    Posted 9 months ago #

    Hey - is this still the case? It would be nice if there was at least a function to run the include so I didn't have to get into looking at the directories to do the include. I understand only wanting it to be loaded at certain times, but a function to get this functionality outside the display side would be awesome.

  6. Hube2
    Member
    Posted 9 months ago #

    Seems to still be the case. I'm using a different custom fields plugin now.

  7. Srdjan
    Member
    Plugin Author

    Posted 9 months ago #

    You can use:
    types_get_field_meta_value( $field, $post_id )

    $field - Field name (without 'wpcf-' prefix)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.