adding bot press to Wordpress
# 🤝help
h
Hi All, I have copied the pre-configured code and added it to my Wordpress site within head tags (I’ve also tried body tags too), but when I then update my site and view the page it just shows the link to the bot. How do I get it to show the chat icon instead?
f
you want to use the script in this section of your bot or this one (pre-configured, configurable)

https://cdn.discordapp.com/attachments/1132941707336503296/1133046917622927461/Screenshot_2023-07-24_at_10.43.19_AM.png

https://cdn.discordapp.com/attachments/1132941707336503296/1133046917891375216/Screenshot_2023-07-24_at_10.43.40_AM.png

a
Take a very close look as the icon is tiny. Mine was hidden by the page footer as the same colour
h
Hey @freezing-printer-49373 I have used the pre-configured one and I’ve tried adding it into the body and the head parts of the site but still just shows the link and not the icon?
@adventurous-glass-22349 The page is white, so I don’t think it’s that?
r
Are you able to share a URL where this is installed?
h
@rich-oxygen-43707 This is one that I’ve setup for testing it, so ignore the text but you’ll see there is links to the actual bot but no icon https://cgai4.wordpress.com/about/
r
How did you include the scripts in your page? Looking at the source that is rendered, obviously, I just see the links. I don't see the <script src= etc that is shown in @freezing-printer-49373 's image above. Can you show a screen snip of where and how you included the scripts?

https://cdn.discordapp.com/attachments/1132941707336503296/1133294458880925796/image.png

h
So yeah I just noticed that too. What I did was copied the script src from my botpress and inserted it inside of a body tag (like I said I have also tried it inside a head tag too), but looks like it’s been changed to an ahref instead (not done by me) so obviously I’m doing something wrong so how can I stop that from happening?
Can you confirm the tag where I should be inserting this? And also does it matter where in the code I put it? (Sorry not an HTML expert or novice even for that matter 😂)
r
well, if your theme gives you a way to add scripts it might look like this.

https://cdn.discordapp.com/attachments/1132941707336503296/1133296501423095878/image.png

ANother option is to put something like this in functions.php function enqueue_custom_scripts() { // Enqueue the first script wp_enqueue_script( 'botpress-inject', 'https://cdn.botpress.cloud/webchat/v0/inject.js', array(), '1.0', true ); // Enqueue the second script with the "defer" attribute wp_enqueue_script( 'botpress-config', 'https://mediafiles.botpress.cloud/9223b195-3517-489e-b0cc-0bb9c7f72749/webchat/config.js', array(), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'enqueue_custom_scripts' );
h
Can I do this on the free plan? If so, how do I find them? I’ve gone to customise my theme but can’t find how to add scripts to it? Also I’ve been looking at updating functions.php, but again I can’t find that either
r
I have never used wordpress.com, I have dozens of sites self-hosted with WordPress. So I'm not sure what all of the restrictions are, what they let you do or what you can't do. Sorry. But I would think that if you have a theme that gives you a place to add scripts, it would work. You may also be able to just copy the code into an HTML block. Maybe add an HTML block in your footer and add the code and see if it works. Just make sure you are copying exactly like this, don't try to go get the contents of those js files.

https://cdn.discordapp.com/attachments/1132941707336503296/1133298946408722512/image.png

I have to go to bed, hopefully this was at least a little helpful.
h
No problem! I appreciate all your help
a
Hey I just added an html block to a Wordpress page and dropped the default botpress script it gives you into that and all works fine BUT mine is self hosted Wordpress not Wordpress.com. Does Wordpress.com allow you to run external scripts??? You may want to ask them as not sure you can run this on their platforms…
h
Hey, thanks for that. I’ve tried that but for some reason Wordpress seems to add tags. Any ideas?
r
Can you share a screen print showing clearly what you are pasting and where?