Forum in maintenance, we will back soon ๐
Adding extra ai tools in WordPress on the same page using Elementor
Hi Hasan. I have been able to add a fully functional AI tool to my WP site by following your guide here - https://learnwithhasan.com/create-ai-tools-with-wordpress/ but I am wanting to add multiple tools that use different prompts to the same page as shown in the attached image, but any additional tools I add don't work when I press the blue button. I have successfully changed the prompts in the code, just can't get additional tools to work, unless I delete all but one of them. Would you mind letting me know how I can change the code to allow more than one script work on the same page please, and the process behind it, so I can learn how to do it in future projects going forward?ย Thank you ๐ย
ย
Do you use different function names? You'll need to do that.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack
Yes you can, but u will need to change function names in both us code and php
Hi guys thanks for you feedback ๐ No I hadn't changed any functions, but have been trying for a while now, and still cant get it working the second tool working unless i delete the first one.
Are you referring to editing this part of the WP Code backend snippet -ย
function openai_generate_text() {
// Get the topic from the AJAX request
$prompt = $_POST['prompt'];
The only JS I can find that mentions functions on the page the tools are on is -ย
document.getElementById("generate-button").addEventListener("click", function(e){
e.preventDefault();
and the copy to clipboard code -ย
copyButton.addEventListener('click', function() {
var result = document.getElementById('result');
ChatGPT code Interpreter keepsย telling me I need change the EventListeners.
Been trying for the last few hours to get this working, but I am out of ideas, if you could elaborate further on what I need to do, that would be great, thanks again ๐ย ย
ย
ย
@jonr When pasting code please use the code (<>) icon. We were referring to the names of the functions.
Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack