Forums

Custom Field Template
[resolved] Getting custom fields from a custom post... (2 posts)

  1. Anrkist
    Member
    Posted 5 months ago #

    ...with a catch. I'm trying to pull the custom field values into a page separate from the posts.

    Getting the_title and the_content works perfectly, however the custom field is not posted.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I've created custom posts called jobs and within those custom posts are a custom field called testJobs. Ideas? Everything here works except the custom field output.

    http://wordpress.org/extend/plugins/custom-field-template/

  2. Anrkist
    Member
    Posted 5 months ago #

    Hah. Success. I knew the main issue was post->ID, as far as I know, that calls to the current post/page your on.

    Replace:
    <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'testJobs', true);?>

    With:
    <?php echo get_post_meta(get_the_ID(), 'testJobs', true);?>

    Hope this helps someone else. Now on to my new problem... how to turn testJobs (file upload) into a link and not just the ID of the file.

Reply

You must log in to post.

About this Plugin

About this Topic