• Hi,

    I am using WP with Gravtify forms and Twenty20. I would like to execute twenty20 inside the html block with two variables dynamically generated from user input (two images IDs that have already been dynamically uploaded to WP gallery).

    I tested three different ways:
    1)writing this code on the html field (storing JS variables in localStorage)
    <div id=”slider”></div>
    <script type=”text/javascript”>
    var id1=localStorage.getItem(“id_1”);
    var id2=localStorage.getItem(“id_2”);
    var code='[twenty20 img1=”‘+id1+'”‘+’ ‘+’img2=’+'”‘+id2+'”‘+’]’;
    jQuery(“#slider”).html(code);
    </script>
    But it only posts “Twenty20 need two images.”

    2) writing this code on functions.php (storing id variables in session variable)
    echo do_shortcode( ‘[twenty20 img1=”‘. json_decode($_SESSION[“id_images”])[0] . ‘” img2=”‘. json_decode($_SESSION[“id_images”])[1] . ‘]’ ); it works

    3) if I just hardcode the shortcode with static IDs on the HTML block it also work, I think is due to not understanding whole shortcode with variables on it

    any help on this? thanks in advance

The topic ‘Executing shortcode inside a html block in GF’ is closed to new replies.