• Resolved ThomasAJ

    (@thomasaj)


    I use the following in pages to help with email address obfuscation and I enter it using the text editor and it works fine. (see at end)
    I am in Customizing Footer > Widget Area 1, clicked Add Block, selected code and entered my code where it said “Write code…”.
    But the code is not executed and just displays are text.

    ‘<p><script language=”javascript”>
    <!–
    var contact1=”xyz”
    var contact2=”@xyz”
    var contact3=”.com”
    var email=”xyz”
    var emailHost=”xyz.com”
    document.write(““+ contact1 + contact2 + contact3 + ““)
    //–>
    </script></p>`

Viewing 6 replies - 1 through 6 (of 6 total)
  • Eduard

    (@cteduard)

    Hey @thomasaj

    There are multiple ways you can achieve this. The easiest would be to use our Custom Code Snippets extension, if you’re part of the Blocksy Premium membership.

    If you’re a Free member, then you could try a plugin like this — https://www.ads-software.com/plugins/custom-css-js/

    Hope this helps!

    Thanks

    Thread Starter ThomasAJ

    (@thomasaj)

    OK thx Eduard

    So I don’t understand what code is supposed to be entered into the ‘Write code…’ area?

    Eduard

    (@cteduard)

    Hey @thomasaj

    I’m pretty sure the code area is solely for HTML code. It is a limitation that’s coming from WordPress itself. A theme cannot control this as far as I know. Only if they offer Gutenberg Blocks, which we do not for the moment.

    Hope this makes sense.

    Theme Author creativethemeshq

    (@creativethemeshq)

    Hi @thomasaj,
    If you are using the standard WordPress code block – it won’t execute the code, this block is for displaying an example of code to your visitors.

    Try instead to place your code inside the HTML block – https://tppr.me/kDQVL

    But, I’m not really sure this is the best way of outputting a code on your website.
    Like my colleague mentioned, it would be better to use a plugin like Simple Custom CSS and JS or Code Snippets.

    Hope this helps.

    Thread Starter ThomasAJ

    (@thomasaj)

    Holy smoke @creativethemeshq that’s perfect. Hm…I thought I had tried that… but obviously not… newbie to WP must be the reason… many confusions… no surprise there!

    Cannot thank you guys/gals enough for the…dare I say it…AWESOME replies…oh I do sound like a newbie…blush.

    Theme Author creativethemeshq

    (@creativethemeshq)

    Hey @thomasaj, you’re welcome!
    And don’t worry, we totally understand everything very well ??

    Let us know in case you will have any other questions.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add simple inline Javascript code to Widget in Footer’ is closed to new replies.