Support

Account

Home Forums General Issues Show User data in page

Helping

Show User data in page

  • Thanks to @John Huebner I was able to introduce this code in the file funtions.php in my theme (Divi), with it I can show the fields of the logged-in current user.

    add_shortcode(‘acf_current_user_field’, ‘acf_current_user_field_shortcode’);
    function acf_current_user_field_shortcode($atts) {

    // extract attributs
    extract(shortcode_atts(array(
    ‘field’ => ”,
    ‘format_value’ => true
    ), $atts));

    // get the current user
    $user_id = get_current_user_id();

    // get value and return it
    $value = get_field($field, ‘user_’.$user_id, $format_value);

    // array
    if( is_array($value) ) {
    $value = @implode( ‘, ‘, $value );
    }

    // return
    return $value;

    }

    Now I need to show all the fields that I created with ACF on certain pages. The fields are:

    Nombre del establecimiento:
    Responsable:
    CIF/NIF:
    Dirección:
    C.P.:
    Localidad:
    Provincia:
    Plan de higiene

    Upload PDF (show pdf added)

    Aparato 1:
    Tipo
    Modelo:
    Temperatura límite:
    Alimentos que contiene:

    How do I display the results of these fields on a page?

  • Can someone help me?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.