Support

Account

Home Forums Front-end Issues the_field() and shortcode [acf field="field_name"] returns numerical value

Solving

the_field() and shortcode [acf field="field_name"] returns numerical value

  • Hi.
    I have created a custom post type called wine tasting notes, and I am trying to create a custom post type template by creating a new single.php file for wine tasting notes. I’ve assigned custom fields to this post type, but when I use the shortcodes for displaying custom field values in my posts, as well as the the_field(“field_name”) code in my single.php, the custom fields displays numerical values, instead of the values I’ve entered when creating the post.

    See:
    http://www.pastaevinoblog.com/wordpress/wines/wine-tasting-note-1/

    I am wondering how I can display the real values of my custom fields, not what seem to be the ID of the custom field values.

    Also, I am wondering whether it is possible to edit the CSS code in order to remove the grey background behind the custom field values, as well as to add a small 16x16px icon to the left of the displayed values. 🙂

    Best regards,
    Kenneth

  • Please see the following attachment as to how I want the custom field values to be displayed. An example of how I want to tweak the CSS + the displaying of the custom field values, is:

    Icon: Grape cluster
    Text to the right of the icon: “Grape Variety:”
    Displayed custom field value to the right of the icon + text: E.g. “Sangiovese”

    Would this be possible?

  • Hi @vinofanten

    Just to clarify, is the field in question an image field? What is the return type option for this field? Is is set to return the image ID?

    If so, then it is doing exactly what you told it to. Please read the docs to find out how to render an image

    Thanks
    E

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘the_field() and shortcode [acf field="field_name"] returns numerical value’ is closed to new replies.