• Resolved alex.schwartzwald

    (@alexschwartzwald)


    Is it possible to insert the JS code below without putting it in the header or footer of a specific page? The widget shows up twice because the plugin only gives you those two options. I installed this plugin since I don’t know how to insert JS code any other way with WordPress.

    <script>(function() {
    var script = document.createElement(‘script’), pg_id = Date.now()+(Math.random()*(999-100)+100);
    document.write(‘<div id=”docalyticsdocbox_’+pg_id+'” style=”display:none”></div>’);
    script.src = ‘//app.docalytics.com/static/embeds/js/doc_box.js#865b0dd9-fe04-11e3-98ef-e1d8900ed8c7:’+pg_id+’:0:0:wide:f7cb38:307feb:ffffff’;
    script.async = true; script.className=’docalytics_docbox_loader’
    var entry = document.getElementsByTagName(‘script’)[0];
    entry.parentNode.insertBefore(script, entry);
    })();</script>

    https://www.ads-software.com/plugins/css-javascript-toolbox/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Are you saying that: When you use Shortcode for inserting a Block its printed twice, one in the post content and one in the header/footer?

    If yes, then I believe you’re doing it wrong!

    Why you assigning a Block to a page while you’re inserting as Shortcode?!

    If you need to insert a code Block into a post content, just do the following;

    1. Create Code Block
    2. Add your code there (JS Code above)
    3. Save Block
    4. Edit the Post you like to insert the Shortcode
    5. Select the code block from the TinyMCE CJT Shortcode buttons list
    6. Save post.

    NOTE: We didn’t assign the Code Block to the page as its already inserted as Shortcode.

    Short code blocks doesn’t use assignment.

    Hope that helps!

    Regards,
    AHMeD

    Thread Starter alex.schwartzwald

    (@alexschwartzwald)

    That does help! I had the block assigned to a specific page while I was also using the Shortcode.

    I appreciate the quick response Ahmed.

    Good!

    You’re very welcome

    Thanks for using CJT

    Regards,
    AHMeD

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do you have to insert JavaScript into header or footer only?’ is closed to new replies.