Grow your CSS skills. Land your dream job.

Advanced Custom Fields Plug in.

  • Rai
    # February 16, 2012 at 2:20 pm

    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:



    < ?php

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

    Dirección clases:' . $direccion_clases . '

    ';
    }

    ?>

    Thanks.

    # February 16, 2012 at 2:24 pm

    try this:

    < ?php

    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.

    # February 16, 2012 at 11:41 pm

    Best. Plugin. Ever.

    Glad you’re using it!

    Rai
    # February 17, 2012 at 10:25 am

    Many thanks Jamy!. Super duper help. :)

    Rai
    # February 17, 2012 at 11:00 am

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

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".