· · ·

Creating a Fortune Cookie Generator Using ChatGPT

We all know, that I love Japanese culture. I decided to do another fun project but this time, I felt like creating a repo, to show you the actual outputs…

We all know, that I love Japanese culture. I decided to do another fun project but this time, I felt like creating a repo, to show you the actual outputs that ChatGPT created. Take a look at the repo here for the full package.

Here’s how I brought this fortune cookie to fruition using ChatGPT!!

Step 1: Generating a Plugin

ChatGPT Prompt:

“Create a custom wordpress plugin that generates a fortune cookie for them. Have at least 100 fortunes for people that they could randomly get each time they press a “whats my fortune” button.”

Output:

After some tweaking and testing, I had a fcg-scrpt.js, fcg-style.css, and fortune-cookie-generator.php.

Step 2: Install the Plugin

  1. Download the plugin ZIP: fortune-cookie-generator.zip.
    • I decided to create a new github for this blog to showcase the projects I have done. You can check out the repo here: Cookie Generator Repo
  1. In your WordPress dashboard, go to Plugins → Add New → Upload Plugin.
  2. Upload the ZIP and click Activate.

Step 1: Add the Shortcode

Place the shortcode anywhere on a page, post, or widget.

Visitors will see:

  • A “What’s my fortune?” button.
  • A randomly selected fortune that appears when you click the button

Step 3: Customize Your Fortunes (Optional)

Want to add your own sayings, quotes, or tips?

  1. Open the plugin folder: wp-content/plugins/fortune-cookie-generator/.
  2. Edit fortune-cookie-generator.php.
  3. Look for the $fortunes array and add, remove, or change entries.

You can also swap images or tweak the CSS for colors, sizes, or animation in fcg-style.css.


Step 4: Test and Enjoy

  • Click the button — a fortune appears!
  • Works with multiple shortcodes on a page.
  • Fun, engaging, and interactive for your visitors.