Live Search and Custom Fields - Docs

  1. Home
  2. Live Search and Custom Fi...
  3. Custom Template
  4. Create New Data Tag

Create New Data Tag

!important: This feature is available in LSCF PRO from 2.4.9 version

A new custom template data tag can be created using an action hook that needs to be inserted in the functions.php file.

add_action( 'lscf_custom_tags', 'lscf_custom_tags_function' );
function  lscf_custom_tags_function( &$args ) {
$post_id = (int) $args['ID'];
$args['my_custom_tag'] = 'The new LSCF custom tag's value';

The new created tag ca be used now into LSCF template file as:




Creating a new LSCF data tag that will bring the ACF custom field value:

in function.php we’ll have the following PHP code

add_action( 'lscf_custom_tags', 'lscf_custom_tags_get_acf_fields' );
function  lscf_custom_tags_get_acf_fields( &$args ) {
$post_id = (int) $args['ID'];
$acf_value = get_field( 'my_field', $post_id );
$args['acf_field'] = $acf_value;

Now we can get the new custom created tag data value into a LSCF template as:


Placing Pixels.
Growing Ideas.