WP Manifestindependent plugin directory
manifest / developer / demo-content-plugin

Demo Content Generator

AI-powered demo content generator for WordPress using OpenAI

by Your Name · github.com/moeloubani/demo-content-plugin · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/moeloubani/demo-content-plugin/archive/refs/heads/main.zip

Generate AI-powered demo content for WordPress using OpenAI's GPT models. Perfect for theme developers, agencies, and anyone who needs realistic content quickly.

Features

  • AI-Powered Content: Uses OpenAI GPT-4o-mini to generate high-quality, topic-specific content
  • Featured Images: Automatically generates relevant images using DALL-E 3
  • Multiple Post Types: Supports posts, pages, and custom post types
  • Modern UI: Clean, intuitive admin interface
  • Extensible: Built with hooks and filters for easy customization
  • Free & Open Source: Base plugin is free, with premium add-ons coming soon

Installation

  1. Download or clone this repository to /wp-content/plugins/demo-content-plugin/
  2. Activate the plugin through the WordPress admin
  3. Go to Demo Content in the WordPress admin menu
  4. Enter your OpenAI API key (get one at platform.openai.com)

Usage

  1. Enter API Key: Add your OpenAI API key and click "Validate"
  2. Choose Subject: Enter the topic for your demo content (e.g., "Organic Gardening")
  3. Select Post Types: Check which post types you want content generated for
  4. Set Quantity: Choose how many items per post type
  5. Generate: Click the big button and watch the magic happen!

Requirements

  • WordPress 5.0 or higher
  • PHP 7.4 or higher
  • OpenAI API key
  • Active internet connection

Extensibility

The plugin is built with extensibility in mind. Here are the key hooks:

Actions

// Before content generation starts
do_action('demo_content_before_generation', $subject, $post_types, $items_per_type);

// After content generation completes
do_action('demo_content_after_generation', $results, $subject, $post_types);

// After a single post is created
do_action('demo_content_post_created', $post_id, $post_type, $content_data);

// When plugin is loaded
do_action('demo_content_loaded');

Filters

// Modify available post types
apply_filters('demo_content_available_post_types', $post_types);

// Customize OpenAI text generation parameters
apply_filters('demo_content_openai_text_params', $data, $prompt, $model);

// Customize OpenAI image generation parameters
apply_filters('demo_content_openai_image_params', $data, $prompt, $size);

// Modify title generation prompt
apply_filters('demo_content_title_prompt', $prompt, $subject, $post_type, $item_number);

// Modify content generation prompt
apply_filters('demo_content_content_prompt', $prompt, $subject, $post_type, $title);

// Modify image generation prompt
apply_filters('demo_content_image_prompt', $image_prompt, $subject, $title);

// Filter generated content before creating post
apply_filters('demo_content_generated_item', $data, $subject, $post_type, $item_number);

// Filter post data before wp_insert_post
apply_filters('demo_content_post_data', $post_data, $post_type, $content_data);

// Enable/disable image generation
apply_filters('demo_content_enable_image_generation', true, $subject, $title);

// Custom handler for specific post types
apply_filters('demo_content_custom_post_type_handler', null, $post_type, $subject, $items_per_type, $openai);

// Customize post type icon in admin
apply_filters('demo_content_post_type_icon', $icon, $post_type);

Creating Add-ons

Add-ons can extend the plugin to support additional post types or features. Here's an example:

<?php
/**
 * Plugin Name: Demo Content - WooCommerce Products
 * Description: Generate WooCommerce products with Demo Content Generator
 */

// Handle WooCommerce product generation
add_filter('demo_content_custom_post_type_handler', function($handler, $post_type, $subject, $items_per_type, $openai) {
    if ($post_type === 'product') {
        $products = array();

        for ($i = 0; $i < $items_per_type; $i++) {
            // Your custom product generation logic here
            $product_id = create_woocommerce_product($openai, $subject, $i);
            $products[] = array(
                'id' => $product_id,
                'title' => get_the_title($product_id)
            );
        }

        return $products;
    }

    return $handler;
}, 10, 5);

Coming Soon: Premium Add-ons

  • WooCommerce Products: Generate complete product catalogs with variations, pricing, and galleries
  • User Accounts: Create demo users with realistic profiles and avatars
  • Media Library: Bulk fill your media library with topic-specific images
  • Custom Fields: Automatically populate ACF, CMB2, and other custom fields
  • Taxonomies: Generate categories, tags, and custom taxonomies
  • Comments: Add realistic comments and reviews to content

Cost Considerations

This plugin uses OpenAI's API which charges based on usage:

  • GPT-4o-mini: ~$0.15 per 1M input tokens, ~$0.60 per 1M output tokens
  • DALL-E 3: ~$0.04 per standard quality 1024x1024 image

For example, generating 10 posts with images typically costs less than $0.50.

Support

  • Documentation: [Coming soon]
  • Issues: GitHub Issues
  • Email: support@example.com

License

GPL v2 or later

Credits

Built with ❤️ using OpenAI's powerful APIs.