Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Advanced Custom Fields Plug in.

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36692
    Rai
    Member

    Hi there,
    I´m using Advanced Custom Fields on a wordpress site and I need help with this:
    What I should do to get the field only if is available and if is not show nothing???.
    Here is my code but is not working:




    if(the_field('direccion_clases'))
    {
    echo '

    Dirección clases:' . $direccion_clases . '

    ';
    }

    ?>

    Thanks.

    #96810
    jamygolden
    Member

    try this:

    
    
    if ( function_exists('get_field') && get_field('direccion_clases') )
    {
    echo '

    Dirección clases:' . get_field('direccion_clases') . '

    ';
    }

    ?>

    Remember, the_field() is already ‘echoed’, much like the_content() and the_permalink().

    get_field() gets the value without echoing.

    #96848
    TheDoc
    Member

    Best. Plugin. Ever.

    Glad you’re using it!

    #96883
    Rai
    Member

    Many thanks Jamy!. Super duper help. :)

    #96884
    Rai
    Member

    Here you can see it working:
    http://www.apky.cl

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.