In this lecture, I’ll take you through the process of creating a custom tool and publishing it on your WordPress site as I did with my Tools.
We’ll cover the steps from understanding the Tool structure to integrating it with WordPress functionalities, including user access and point management.
And to make things simple, we will go with a real example from my tools. And I will show you how I built the YouTube Title Generator Tool.
Look at this picture:
You can see two main parts:
The OpenAI API is used to generate YouTube Titles based on our prompt. We will talk more about this later.
Let’s Get into this step by step!
We will start with the backend, and we will create the function that generates YouTube titles with the help of the OpenAI API.
Demo Video (Create the basic function and test with API Client, get API key, and mention that you need an active subscription based on token pricing. The update and test)
[Test Here Basic]
[Test Here OpenAI Generate]
Great! So now we have the backend function that generates titles and returns the JSON response. It is time to build a UI for our tool, The Frontend!
This includes two steps:
Let’s Do it:
Demo Video: Create the tool, test locally, and publish on WordPress
[Get The Code Here]
[Test Here]
Ok, now we have our tool published and working properly. we want to allow only Logged-in users to use it.
Yeah, we learned before, that you can hide from non-logged-in users. But this will not protect our tool from some techy users who will hijack your tool with some techniques, so it is better to check if the user is logged in from the backend function.
It is super simple, you just add this line of code:
if (!is_user_logged_in()) { return; }
Demo Video:
Show how to add the function, and how it is not working. you can ad custom message box as I do on my website. (show them) I will give you all my codes in the next lecture.
Now it is time to
Code to Check Points:
Demo Video: Implement and test.
In the next lecture, I will go in deep in my system and give you my codes to get the full user experience I have on my site.