PHP code example of moderntribe / square1-field-models
1. Go to this page and download the library: Download moderntribe/square1-field-models library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
moderntribe / square1-field-models example snippets
$user = new \Tribe\Libs\Field_Models\Models\User( (array) get_field( 'user_field' ) );
echo $user->ID; // e.g. 22
echo $user->user_firstname; // e.g. Steve
// etc...
$user_collection = \Tribe\Libs\Field_Models\Collections\User_Collection::create( (array) get_field( 'user_repeater' ) );
foreach ( $user_collection as $user ) {
echo $user->ID;
}