PHP code example of corcel / acf

1. Go to this page and download the library: Download corcel/acf 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/ */

    

corcel / acf example snippets


$post = Post::find(1);
echo $post->acf->url; // returns the url custom field created using ACF

 // Extra queries way
 echo $post->acf->author_username; // it's a User field

 // Without extra queries
 echo $post->acf->user('author_username');