';
echo '
';
echo '';
echo $field['instructions'];
echo '
';
$field['name'] = 'fields[' . $field['key'] . ']';
do_action('acf/create_field', $field, $post_id);
echo '
';
}}
}
/*
* save_post_lock
*
* This action sets a global variable which locks the ACF save functions to this ID.
* This prevents an inifinite loop if a user was to hook into the save and create a new post
*
* @type function
* @date 16/07/13
*
* @param {int} $post_id
* @return {int} $post_id
*/
function save_post_lock( $post_id )
{
$GLOBALS['acf_save_lock'] = $post_id;
return $post_id;
}
/*
* save_post_unlock
*
* This action sets a global variable which unlocks the ACF save functions to this ID.
* This prevents an inifinite loop if a user was to hook into the save and create a new post
*
* @type function
* @date 16/07/13
*
* @param {int} $post_id
* @return {int} $post_id
*/
function save_post_unlock( $post_id )
{
$GLOBALS['acf_save_lock'] = false;
return $post_id;
}
/*
* save_post
*
* @description:
* @since: 3.6
* @created: 28/01/13
*/
function save_post( $post_id )
{
// load from post
if( !isset($_POST['fields']) )
{
return $post_id;
}
// loop through and save
if( !empty($_POST['fields']) )
{
// loop through and save $_POST data
foreach( $_POST['fields'] as $k => $v )
{
// get field
$f = apply_filters('acf/load_field', false, $k );
// update field
do_action('acf/update_value', $v, $post_id, $f );
}
// foreach($fields as $key => $value)
}
// if($fields)
return $post_id;
}
}
/*
* acf
*
* The main function responsible for returning the one true acf Instance to functions everywhere.
* Use this function like you would a global variable, except without needing to declare the global.
*
* Example:
*
* @type function
* @date 4/09/13
* @since 4.3.0
*
* @param N/A
* @return (object)
*/
function acf()
{
global $acf;
if( !isset($acf) )
{
$acf = new acf();
}
return $acf;
}
// initialize
acf();
endif; // class_exists check
?>