WordPress.org

Support

Support » Plugins and Hacks » Custom Content Type Manager » [Resolved] how to display a single field of a custom field with values ​​repeatable

[Resolved] how to display a single field of a custom field with values ​​repeatable

Viewing 1 replies (of 1 total)
  • Plugin Contributor fireproofsocks

    @fireproofsocks

    If you only want the first item, then you’ll have to handle the output manually. As mentioned in your other thread, a repeatable field (or any field that stores multiple values) stores its data as a JSON array. You can use json_decode() to manually convert the string stored in the database, or use the CCTM’s output filters to help you, e.g. https://code.google.com/p/wordpress-custom-content-type-manager/wiki/to_array_OutputFilter

    <?php
    $array = get_custom_field('fieldName:to_array');
    print $array[0]; // prints the 1st element of the array
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] how to display a single field of a custom field with values ​​repeatable’ is closed to new replies.
Skip to toolbar