WCK Custom Fields API

WordPress Creation Kit features an easy to use Custom Fields API. Below is a list of all the available functions:

the_cfc_field()

Description

This function echoes out the information found inside the field.

Usage

1
<?php the_cfc_field($meta_name, $field_name, $post_id = false, $key = 0, $do_echo = true ); ?>

Parameters

  1. $meta_name (string)(required) – A string containing the name of the meta box

    -> Default: None

  2. $field_name (string)(required) – A string containing the slug of the field. This is generated from the field title by replacing uppercase letters with lowercase and spaces with dashes

    -> Default: None

  3. $post_id: (integer)(optional) – The ID of the post to which the custom field is attached to

    -> Default: false

  4. $key: (integer)(optional) – Represents the number of the entry for a repeater metabox (starting at 0)

    -> Default: 0

  5. $do_echo: (bool)(optional) – Weather the function does an echo or a return

    -> Default: true

Return Value

The function will return a string.

get_cfc_field()

Description

This function returns a pre-processed custom field.

Usage

1
<?php $field = get_cfc_field( $meta_name, $field_name, $post_id = false, $key = 0 ) ?>

Parameters

  1. $meta_name (string)(required) – A string containing the name of the meta box

    -> Default: None

  2. $field_name (string)(required) – A string containing the slug of the field. This is generated from the field title by replacing uppercase letters with lowercase and spaces with dashes

    -> Default: None

  3. $post_id (integer)(optional) – The ID of the post to which the custom field is attached to

    -> Default: false

  4. $key (integer)(optional) – Represents the number of the entry for a repeater metabox (starting at 0)

    -> Default: 0

Return Value

  1. In case of a Text, Textarea, WYSIWYG, Select, Radio, Country Select, Date, User Select the function will return a string.
  2. In case of a Checkbox field the function will return an array with all the checked options.
  3. In case of an Upload field the function will return a string with the image URL
  4. In case of a Custom Post Type select the function will return the ID..

get_cfc_meta()

Description

This function returns the entire non processed post meta.

Usage

1
<?php $meta_values = get_cfc_meta( $meta_name = false, $post_id = false  ) ?>

Parameters

  1. $meta_name (string)(required) – A string containing the name of the meta box

    -> Default: None

  2. $field_name (string)(required) – A string containing the slug of the field. This is generated from the field title by replacing uppercase letters with lowercase and spaces with dashes

    -> Default: None

  3. $post_id (integer)(optional) – The ID of the post to which the custom field is attached to

    -> Default: false

  4. $key (integer)(optional) – Represents the number of the entry for a repeater metabox (starting at 0)

    -> Default: 0

Return Value

The function will return a string.