PHP code example of magnum34 / acf_custom

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

    

magnum34 / acf_custom 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');