Support

Account

Home Forums Front-end Issues Need help implementing shortcode

Solving

Need help implementing shortcode

  • Hi. Great plugin!

    I need to add the following short code for the Ninja Forms Modal Popup to a template:
    [ninja_forms_modal_form id=1 text_link=’Request a demo’]

    I tried using this but couldn’t get it to work.
    <?php shortcode = get_field(’ request_demo_shortcode’); echo do_shortcode($shortcode); ?>

    I read some of the documentation but am still having trouble getting it to work.

    Thanks!

  • Hi @cvelez27,

    You have a syntax error in your code. Your are missing a $ for the variable $shortcode. Change your code to the following: <?php $shortcode = get_field(’ request_demo_shortcode’); echo do_shortcode($shortcode); ?>

    Also you need to ensure that $shortcode contains the correct data. print_r($shortcode); to find out if it has any data.

  • it is also possible that shortcode unfortunately get formatted, than this should work:

    <?php $shortcode = get_field('request_demo_shortcode', false, false);
    do_shortcode($shortcode);?>

    (3 parameter should be false)

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

You must be logged in to reply to this topic.