WP Manifestindependent plugin directory
manifest / ai / name-generator-plugin

Baby Name Generator

AI-powered baby name generator (Google Gemini).

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/cjbodullo/name-generator-plugin/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

WordPress plugin that renders an AI-powered baby name generator via shortcode.

Text domain: baby-name-generator Version: 1.0.0 (BNG_VERSION in the main plugin file).

Requirements

Installation

  1. Copy the folder name-generator-plugin into wp-content/plugins/.
  2. In Plugins, activate Baby Name Generator.
  3. Open Settings → Baby Name Generator and paste your Gemini API key. Optionally change the model (default gemini-2.0-flash).
  4. Add the shortcode [baby_name_generator] to any page or post.

Shortcode

[baby_name_generator]

Attributes (all optional)

Attribute Default Purpose
title FIND THE PERFECT BABY NAME FOR YOUR LITTLE ONE Heading shown above the form.
intro_top Lead copy from the standalone tool First (bold) intro paragraph. Pass empty string to hide.
intro_bottom Long description from the standalone tool Second intro paragraph. Pass empty string to hide.
count 8 Names per initial Generate (1–20).
more_count 5 Names per Show More click (1–20).

Example

[baby_name_generator title="Pick a Name" intro_top="" intro_bottom="" count="6" more_count="4"]

Features

  • Filters: gender (All / For Him / For Her / Neutral), one or more first letters, origin, style, meaning, # syllables.
  • Free text "Search by name" for "names similar to…".
  • Generate triggers a JSON-mode Gemini call (generateContent with responseMimeType: application/json).
  • Show more keeps the original criteria and excludes already-shown names so results stay unique.
  • Inline expanding card per name with origin, meaning, popularity, and a 2–3 sentence description.
  • Heart / plus icons toggle locally (no persistence yet).

Architecture

Piece Path
Plugin entry name-generator-plugin.php
Shortcode markup bng_render_shortcode()
AJAX endpoint wp_ajax_bng_generate_names (and _nopriv for visitors) — bng_handle_generate_names()
Gemini call bng_call_gemini_api() using wp_remote_post
Front-end JS assets/js/baby-name-generator.js
Styles assets/css/baby-name-generator.css (all selectors prefixed bng-)
Admin settings Settings → Baby Name Generator (options-general.php?page=baby-name-generator)

The API key is stored in the wp_options row keyed by bng_settings and is never exposed to the browser. The browser only sees a per-page nonce.

Security notes

  • Public AJAX is nonce-protected (bng_generate_names).
  • All form fields are validated against an allow-list before they reach the model.
  • Returned names are sanitised with sanitize_text_field / wp_kses_post before being sent back to the browser, then injected as text (not HTML) on the client to keep the DOM safe even if the model misbehaves.
  • Settings page requires manage_options.

Customising

  • CSS is fully scoped under .bng-shell; override any rule from your theme by targeting .bng-shell .bng-….
  • Change the default model or use a different one (e.g. gemini-1.5-pro) from the settings page.
  • The prompt is built in bng_build_prompt() — tweak it there if you want different output guidance.