/*
Theme Name: Avada Child
Description: Child theme for Avada theme
Author: ThemeFusion
Author URI: https://theme-fusion.com
Template: Avada
Version: 1.0.0
Text Domain:  Avada
*/


// Function to get ACF data for a specific user
function get_user_acf_data($atts) {
    // Shortcode attributes
    $atts = shortcode_atts(
        array(
            'user_id' => get_current_user_id(), // Default to the current user
            'field'   => '',
        ),
        $atts,
        'user_acf_data'
    );

    // Check if ACF is active
    if (function_exists('get_field')) {
        // Get ACF field value for the specified user
        $field_value = get_field($atts['field'], 'user_' . $atts['user_id']);

        // Output the field value
        return $field_value;
    } else {
        return 'ACF Pro is not active.';
    }
}

// Register the shortcode
add_shortcode('user_acf_data', 'get_user_acf_data');
