[Support request] Convertflow – how to add script

Home Forums Support [Support request] Convertflow – how to add script

Home Forums Support Convertflow – how to add script

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #770036
    Kevin

    Here is the script:

    <script>
    if (window.convertflow == undefined) {
    var script = document.createElement(‘script’);
    script.async = true;
    script.src = “https://js.convertflow.co/production/websites/3983.js&#8221;;
    document.body.appendChild(script);
    };
    </script>

    I added the code in elements to GP_Head and told it to show on a specific page (see admin area)

    I am trying to get this form to display with a background of #F2F2F2 and have it float centered left/right up/down

    #770042
    Leo
    Staff
    Customer Support

    Hi there,

    Are you sure that code is supposed to go in wp_head?

    I’m not seeing a form showing up on the page you linked.

    As for changing the background color, I don’t believe CSS will work inside <script> tag like that. Have you checked with the code author on how to do that?

    #770169
    Kevin

    On my other wordpress site (not generatepress) I just this script into a code box and it works perfect.

    I have no idea on how to do this on generatepress so I tried following the tutorial on elements but I got nowhere.

    How do I inject this code onto a single WordPress page in generatepress

    Thanks!

    #770497
    Tom
    Lead Developer
    Lead Developer

    How exactly did you add it to your previous theme? Inside the content area? Typically, WordPress doesn’t allow script elements inside the content.

    #770596
    Kevin

    They have a “code” box you drop into a section and just dump the script inside.

    You can see it in operation Wildernessedge.thedev.ca right at bottom just before the footer.

    How do I add this code to generatepress? My goal is transfer my current enfold theme to yours?

    #770678
    Tom
    Lead Developer
    Lead Developer

    If you’re using the new editor in WordPress, you should be able to add a Code block, and put that code into the block.

    That should make the form appear wherever you add the code.

    #770701
    Kevin

    Thanks, but I have gutenberg disabled.
    What is the next best method?

    Thanks much,
    Kevin

    #771276
    Tom
    Lead Developer
    Lead Developer

    You could create a shortcode with it:

    add_shortcode( 'convertflow', function() {
        ob_start();
        ?>
    
            Your script here
    
        <?php
        return ob_get_clean();
    } );

    Then you can add the [convertflow] in your content.

    #771332
    Kevin

    ok, so I installed the snippet plugin

    Put an echo line to make sure it was working on my page, which is does

    But still no love in executing this js

    add_shortcode( ‘convertflow’, function() {
    ob_start();
    ?>
    // Start your PHP below

    echo ‘short code example’;

    // End your PHP above
    <script>
    if (window.convertflow == undefined) {
    var script = document.createElement(‘script’);
    script.async = true;
    script.src = “https://js.convertflow.co/production/websites/3983.js”;
    document.body.appendChild(script);
    };
    </script>

    <?php
    return ob_get_clean();
    } );

    Thanks for your patience

    #771586
    Tom
    Lead Developer
    Lead Developer

    Hmm, are there any errors in the console if you right click + inspect?

    If the code is being outputted within the HTML, then there isn’t much more the theme itself can do. It’s on the script itself to take over and display what it needs to display.

    #772200
    Kevin

    ok. super strange. If I switch the whole thing over to the Enfold theme it works. Just get this error when working with generatepress theme.

    thanks for all your help.

    Kevin

    #772280
    Tom
    Lead Developer
    Lead Developer

    That is strange. Can you link me to a specific page where it should be showing up inside the content?

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.