Get a free trial // Grow your CSS skills // Land your dream job

ACF + NGG Shortcodes (WordPress)

  • # July 11, 2013 at 7:44 am

    Hey guys,

    I’m trying to get the value from a custom field I have set up and insert that into NGG to pull the correct gallery.

    Here is what I’m using:

    < ?php $get_short_code = "[nggallery id=" . the_field('image_gallery') . "]";
    echo do_shortcode($get_short_code); ?>

    The result of that output is “19[Gallery Not Found]”.

    19 is the correct value just doesn’t want to work dynamically with the field…. Is there some kind of trick with do_shortcode + ACF fields?

    Any help would be greatly appreciated as I’m very much a failure at PHP currently.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed