Display data some where you want

27/12/2021 | By Dev | Filed in: Advanced Custom Data.

Function acd_the_data

Display the content data.

acd_the_data( $id, $attr );
  • $id (number) (Required) The data id.
  • $attr (array) (Optional) The attributes value.

Examples

Display data text

This example shows how to display the value of data with ID = 1.

acd_the_data( 1 );

Display data list

This example shows how to display the value of data with attribute type = ‘list’.

$attrs = array(
   'type' => 'list'
);
acd_the_data( 1, $attrs );

Display featured image (thumbnail) of data

This example shows how to display the value of data with attribute type = ‘list’.

$attrs = array(
   'type' => 'thumbnail',
   'size' => 'large'
);
acd_the_data( 1, $attrs );

Function acd_data_get_content

Returns the value of a content data.

acd_data_get_content( $id, $type );
  • $id (number|string) (Required) The data id or name.
  • $type (string) (Optional) sanitize field by type before display.

Examples

Get a text from the data

This example shows how to load the value of field ‘text_field’ from the data with ID = 1.

acd_data_get_content( 1, 'text' );

Get a value of (style|script) from the data

This example shows how to load the value of field ‘textarea_field’ from the data with name = ‘city’.

acd_data_get_content( 'city', 'textarea' );

Development …


Comments are closed here.