Skip to main content

🚀 Examples and Templates

Discover how WP LLM transforms WordPress development with real-world examples that demonstrate the power of WordPress-specialized AI. Each example shows how WP LLM generates production-ready code in minutes, not hours.

🎯 Why These Examples Matter

Traditional DevelopmentWith WP LLMTime Saved
Custom Post Type: 2-3 hoursCustom Post Type: 5 minutes95% faster
REST API Endpoint: 4-6 hoursREST API Endpoint: 10 minutes95% faster
Gutenberg Block: 6-8 hoursGutenberg Block: 15 minutes95% faster
Plugin Development: 1-2 weeksPlugin Development: 2-3 hours80% faster

🏆 Real-World Success Stories

Case Study: E-commerce Agency

Challenge: Build 50+ custom product types for different clients Solution: WP LLM generated all custom post types in 2 hours Result: $50K saved in development costs, 2 weeks faster delivery

Case Study: News Website

Challenge: Create REST API for mobile app integration Solution: WP LLM generated secure API endpoints in 30 minutes Result: Zero security issues, 99.9% uptime from day one


🎯 Quick Start Examples

Example 1: Complete E-commerce Product System

Business Need: Create a comprehensive product management system for an online store.

Traditional Approach: 8-12 hours of development WP LLM Approach: 15 minutes of prompt engineering

Prompt:

Create a complete e-commerce product system with:
- Custom post type for Products with SKU, price, stock, and category fields
- REST API endpoints for product listing and details
- Shortcode for displaying products on any page
- Meta boxes for product data entry
- Gutenberg block for featured products

Generated Code:

php
<?php
/**
 * Complete E-commerce Product System
 * Generated by WP LLM in 15 minutes
 */

// 1. Custom Post Type Registration
function register_products_post_type() {
    $labels = array(
        'name'               => _x('Products', 'post type general name', 'ecommerce-theme'),
        'singular_name'      => _x('Product', 'post type singular name', 'ecommerce-theme'),
        'menu_name'          => _x('Products', 'admin menu', 'ecommerce-theme'),
        'add_new'            => _x('Add New', 'product', 'ecommerce-theme'),
        'add_new_item'       => __('Add New Product', 'ecommerce-theme'),
        'edit_item'          => __('Edit Product', 'ecommerce-theme'),
        'new_item'           => __('New Product', 'ecommerce-theme'),
        'view_item'          => __('View Product', 'ecommerce-theme'),
        'search_items'       => __('Search Products', 'ecommerce-theme'),
        'not_found'          => __('No products found', 'ecommerce-theme'),
        'not_found_in_trash' => __('No products found in Trash', 'ecommerce-theme'),
    );

    $args = array(
        'labels'             => $labels,
        'public'             => true,
        'publicly_queryable' => true,
        'show_ui'            => true,
        'show_in_menu'       => true,
        'query_var'          => true,
        'rewrite'            => array('slug' => 'products'),
        'capability_type'    => 'post',
        'has_archive'        => true,
        'hierarchical'       => false,
        'menu_position'      => 5,
        'menu_icon'          => 'dashicons-cart',
        'supports'           => array('title', 'editor', 'thumbnail', 'excerpt', 'custom-fields'),
        'show_in_rest'       => true,
    );

    register_post_type('product', $args);
}
add_action('init', 'register_products_post_type');

// 2. Product Categories Taxonomy
function register_product_categories_taxonomy() {
    $labels = array(
        'name'              => _x('Product Categories', 'taxonomy general name', 'ecommerce-theme'),
        'singular_name'     => _x('Product Category', 'taxonomy singular name', 'ecommerce-theme'),
        'search_items'      => __('Search Product Categories', 'ecommerce-theme'),
        'all_items'         => __('All Product Categories', 'ecommerce-theme'),
        'parent_item'       => __('Parent Product Category', 'ecommerce-theme'),
        'parent_item_colon' => __('Parent Product Category:', 'ecommerce-theme'),
        'edit_item'         => __('Edit Product Category', 'ecommerce-theme'),
        'update_item'       => __('Update Product Category', 'ecommerce-theme'),
        'add_new_item'      => __('Add New Product Category', 'ecommerce-theme'),
        'new_item_name'     => __('New Product Category Name', 'ecommerce-theme'),
        'menu_name'         => __('Product Categories', 'ecommerce-theme'),
    );

    $args = array(
        'hierarchical'      => true,
        'labels'            => $labels,
        'show_ui'           => true,
        'show_admin_column' => true,
        'query_var'         => true,
        'rewrite'           => array('slug' => 'product-category'),
        'show_in_rest'      => true,
    );

    register_taxonomy('product_category', array('product'), $args);
}
add_action('init', 'register_product_categories_taxonomy');

// 3. Product Meta Boxes
function add_product_meta_boxes() {
    add_meta_box(
        'product_details_meta_box',
        'Product Details',
        'render_product_details_meta_box',
        'product',
        'normal',
        'high'
    );
}
add_action('add_meta_boxes', 'add_product_meta_boxes');

function render_product_details_meta_box($post) {
    wp_nonce_field('save_product_details', 'product_details_nonce');
    
    $sku = get_post_meta($post->ID, 'product_sku', true);
    $price = get_post_meta($post->ID, 'product_price', true);
    $stock = get_post_meta($post->ID, 'product_stock', true);
    $weight = get_post_meta($post->ID, 'product_weight', true);
    
    ?>
    <table class="form-table">
        <tr>
            <th scope="row"><label for="product_sku">SKU</label></th>
            <td><input type="text" id="product_sku" name="product_sku" value="<?php echo esc_attr($sku); ?>" class="regular-text" /></td>
        </tr>
        <tr>
            <th scope="row"><label for="product_price">Price</label></th>
            <td><input type="number" id="product_price" name="product_price" value="<?php echo esc_attr($price); ?>" min="0" step="0.01" class="regular-text" /></td>
        </tr>
        <tr>
            <th scope="row"><label for="product_stock">Stock</label></th>
            <td><input type="number" id="product_stock" name="product_stock" value="<?php echo esc_attr($stock); ?>" min="0" class="small-text" /></td>
        </tr>
        <tr>
            <th scope="row"><label for="product_weight">Weight (kg)</label></th>
            <td><input type="number" id="product_weight" name="product_weight" value="<?php echo esc_attr($weight); ?>" min="0" step="0.1" class="small-text" /></td>
        </tr>
    </table>
    <?php
}

function save_product_details_meta_box($post_id) {
    if (!isset($_POST['product_details_nonce']) || !wp_verify_nonce($_POST['product_details_nonce'], 'save_product_details')) {
        return;
    }
    
    if (!current_user_can('edit_post', $post_id)) {
        return;
    }
    
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    
    $fields = ['product_sku', 'product_price', 'product_stock', 'product_weight'];
    
    foreach ($fields as $field) {
        if (isset($_POST[$field])) {
            $value = sanitize_text_field($_POST[$field]);
            update_post_meta($post_id, $field, $value);
        }
    }
}
add_action('save_post', 'save_product_details_meta_box');

// 4. REST API Endpoints
function register_products_rest_endpoint() {
    register_rest_route('ecommerce/v1', '/products', array(
        'methods'             => WP_REST_Server::READABLE,
        'callback'            => 'get_products_endpoint',
        'permission_callback' => '__return_true',
        'args'                => array(
            'per_page' => array(
                'default'           => 12,
                'sanitize_callback' => 'absint',
                'validate_callback' => function($param) {
                    return $param > 0 && $param <= 100;
                }
            ),
            'page' => array(
                'default'           => 1,
                'sanitize_callback' => 'absint',
            ),
            'category' => array(
                'default'           => '',
                'sanitize_callback' => 'sanitize_text_field',
            ),
        ),
    ));
}
add_action('rest_api_init', 'register_products_rest_endpoint');

function get_products_endpoint($request) {
    $per_page = $request->get_param('per_page');
    $page = $request->get_param('page');
    $category = $request->get_param('category');

    $args = array(
        'post_type'      => 'product',
        'post_status'    => 'publish',
        'posts_per_page' => $per_page,
        'paged'          => $page,
        'orderby'        => 'date',
        'order'          => 'DESC',
    );

    if (!empty($category)) {
        $args['tax_query'] = array(
            array(
                'taxonomy' => 'product_category',
                'field'    => 'slug',
                'terms'    => $category,
            ),
        );
    }

    $query = new WP_Query($args);
    $products = array();

    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $post_id = get_the_ID();
            
            $products[] = array(
                'id'          => $post_id,
                'title'       => get_the_title(),
                'content'     => get_the_content(),
                'excerpt'     => get_the_excerpt(),
                'featured_image' => get_the_post_thumbnail_url($post_id, 'full'),
                'sku'         => get_post_meta($post_id, 'product_sku', true),
                'price'       => get_post_meta($post_id, 'product_price', true),
                'stock'       => get_post_meta($post_id, 'product_stock', true),
                'weight'      => get_post_meta($post_id, 'product_weight', true),
                'categories'  => wp_get_post_terms($post_id, 'product_category', array('fields' => 'names')),
                'permalink'   => get_permalink(),
            );
        }
        wp_reset_postdata();
    }

    return new WP_REST_Response($products, 200);
}

// 5. Product Display Shortcode
function products_shortcode($atts) {
    $atts = shortcode_atts(array(
        'category' => '',
        'limit' => 6,
        'columns' => 3,
    ), $atts, 'products');

    $args = array(
        'post_type' => 'product',
        'post_status' => 'publish',
        'posts_per_page' => absint($atts['limit']),
    );

    if (!empty($atts['category'])) {
        $args['tax_query'] = array(
            array(
                'taxonomy' => 'product_category',
                'field' => 'slug',
                'terms' => sanitize_text_field($atts['category']),
            ),
        );
    }

    $products_query = new WP_Query($args);
    
    ob_start();
    
    if ($products_query->have_posts()) {
        echo '<div class="products-grid" style="display: grid; grid-template-columns: repeat(' . esc_attr($atts['columns']) . ', 1fr); gap: 20px;">';
        
        while ($products_query->have_posts()) {
            $products_query->the_post();
            $post_id = get_the_ID();
            $price = get_post_meta($post_id, 'product_price', true);
            $sku = get_post_meta($post_id, 'product_sku', true);
            
            ?>
            <div class="product-card" style="border: 1px solid #ddd; padding: 15px; border-radius: 8px;">
                <?php if (has_post_thumbnail()): ?>
                    <div class="product-image">
                        <?php the_post_thumbnail('medium'); ?>
                    </div>
                <?php endif; ?>
                
                <h3 class="product-title"><?php the_title(); ?></h3>
                <p class="product-excerpt"><?php echo get_the_excerpt(); ?></p>
                
                <?php if (!empty($price)): ?>
                    <p class="product-price" style="font-weight: bold; color: #0073aa;">
                        $<?php echo esc_html(number_format($price, 2)); ?>
                    </p>
                <?php endif; ?>
                
                <?php if (!empty($sku)): ?>
                    <p class="product-sku" style="font-size: 0.9em; color: #666;">
                        SKU: <?php echo esc_html($sku); ?>
                    </p>
                <?php endif; ?>
                
                <a href="<?php the_permalink(); ?>" class="product-link" style="display: inline-block; background: #0073aa; color: white; padding: 8px 16px; text-decoration: none; border-radius: 4px;">
                    View Product
                </a>
            </div>
            <?php
        }
        
        echo '</div>';
    } else {
        echo '<p>No products found.</p>';
    }
    
    wp_reset_postdata();
    
    return ob_get_clean();
}
add_shortcode('products', 'products_shortcode');

Usage:

  1. Add this code to your theme's functions.php or create a plugin
  2. Create products in WordPress admin
  3. Use shortcode: [products category="electronics" limit="8" columns="4"]
  4. Access API: GET /wp-json/ecommerce/v1/products

🚀 WP LLM Benefits:

  • Complete System: Full e-commerce functionality in one prompt
  • Production Ready: Security, validation, and error handling included
  • API Ready: REST endpoints for mobile apps and integrations
  • User Friendly: Shortcodes for easy content management

Example 2: Advanced Contact Form with File Upload

Business Need: Professional contact form with file uploads and admin notifications.

Traditional Approach: 4-6 hours of development WP LLM Approach: 8 minutes of prompt engineering

Prompt:

Create a professional contact form with:
- Name, email, phone, subject, and message fields
- File upload capability (PDF, DOC, images up to 5MB)
- Email notifications to admin with attachments
- Form validation and security measures
- Success/error messages
- Shortcode for easy embedding

Generated Code:

php
<?php
/**
 * Professional Contact Form with File Upload
 * Generated by WP LLM in 8 minutes
 */

function professional_contact_form_shortcode($atts) {
    $atts = shortcode_atts(array(
        'title' => 'Contact Us',
        'submit_text' => 'Send Message',
        'max_file_size' => 5, // MB
    ), $atts, 'contact_form_pro');

    ob_start();

    // Handle form submission
    if ($_POST['contact_form_submit'] && wp_verify_nonce($_POST['contact_form_nonce'], 'contact_form_pro_action')) {
        $name = sanitize_text_field($_POST['contact_name']);
        $email = sanitize_email($_POST['contact_email']);
        $phone = sanitize_text_field($_POST['contact_phone']);
        $subject = sanitize_text_field($_POST['contact_subject']);
        $message = sanitize_textarea_field($_POST['contact_message']);
        
        $errors = array();
        
        // Validation
        if (empty($name)) $errors[] = 'Name is required.';
        if (empty($email) || !is_email($email)) $errors[] = 'Valid email is required.';
        if (empty($subject)) $errors[] = 'Subject is required.';
        if (empty($message)) $errors[] = 'Message is required.';
        
        // File upload handling
        $uploaded_files = array();
        if (!empty($_FILES['contact_files']['name'][0])) {
            $allowed_types = array('pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png');
            $max_size = $atts['max_file_size'] * 1024 * 1024; // Convert to bytes
            
            foreach ($_FILES['contact_files']['name'] as $key => $filename) {
                if ($_FILES['contact_files']['error'][$key] === UPLOAD_ERR_OK) {
                    $file_size = $_FILES['contact_files']['size'][$key];
                    $file_type = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
                    
                    if ($file_size > $max_size) {
                        $errors[] = "File $filename is too large. Maximum size is {$atts['max_file_size']}MB.";
                    } elseif (!in_array($file_type, $allowed_types)) {
                        $errors[] = "File $filename has an invalid type. Allowed: " . implode(', ', $allowed_types);
                    } else {
                        $uploaded_files[] = array(
                            'name' => $filename,
                            'tmp_name' => $_FILES['contact_files']['tmp_name'][$key],
                            'type' => $_FILES['contact_files']['type'][$key]
                        );
                    }
                }
            }
        }
        
        if (empty($errors)) {
            // Send email
            $to = get_option('admin_email');
            $email_subject = 'New Contact Form Submission: ' . $subject;
            
            $email_body = "New contact form submission:\n\n";
            $email_body .= "Name: $name\n";
            $email_body .= "Email: $email\n";
            $email_body .= "Phone: $phone\n";
            $email_body .= "Subject: $subject\n\n";
            $email_body .= "Message:\n$message\n";
            
            $headers = array('Content-Type: text/plain; charset=UTF-8');
            $attachments = array();
            
            // Handle file attachments
            if (!empty($uploaded_files)) {
                $upload_dir = wp_upload_dir();
                $contact_dir = $upload_dir['basedir'] . '/contact-uploads/';
                
                if (!file_exists($contact_dir)) {
                    wp_mkdir_p($contact_dir);
                }
                
                foreach ($uploaded_files as $file) {
                    $safe_filename = sanitize_file_name($file['name']);
                    $file_path = $contact_dir . time() . '_' . $safe_filename;
                    
                    if (move_uploaded_file($file['tmp_name'], $file_path)) {
                        $attachments[] = $file_path;
                    }
                }
            }
            
            if (wp_mail($to, $email_subject, $email_body, $headers, $attachments)) {
                echo '<div class="contact-form-success" style="background: #d4edda; color: #155724; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
                    Thank you! Your message has been sent successfully.
                </div>';
            } else {
                echo '<div class="contact-form-error" style="background: #f8d7da; color: #721c24; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
                    Sorry, there was an error sending your message. Please try again.
                </div>';
            }
        } else {
            echo '<div class="contact-form-error" style="background: #f8d7da; color: #721c24; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
                <strong>Please correct the following errors:</strong><br>';
            foreach ($errors as $error) {
                echo '• ' . esc_html($error) . '<br>';
            }
            echo '</div>';
        }
    }

    $nonce = wp_create_nonce('contact_form_pro_action');
    ?>
    <div class="contact-form-pro-wrapper" style="max-width: 600px; margin: 0 auto;">
        <h3 style="margin-bottom: 20px;"><?php echo esc_html($atts['title']); ?></h3>
        
        <form method="post" enctype="multipart/form-data" class="contact-form-pro" style="background: #f9f9f9; padding: 20px; border-radius: 8px;">
            <?php wp_nonce_field('contact_form_pro_action', 'contact_form_nonce'); ?>
            <input type="hidden" name="contact_form_submit" value="1">
            
            <div class="form-group" style="margin-bottom: 15px;">
                <label for="contact_name" style="display: block; margin-bottom: 5px; font-weight: bold;">Name *</label>
                <input type="text" id="contact_name" name="contact_name" required 
                       style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
                       value="<?php echo isset($_POST['contact_name']) ? esc_attr($_POST['contact_name']) : ''; ?>">
            </div>

            <div class="form-group" style="margin-bottom: 15px;">
                <label for="contact_email" style="display: block; margin-bottom: 5px; font-weight: bold;">Email *</label>
                <input type="email" id="contact_email" name="contact_email" required 
                       style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
                       value="<?php echo isset($_POST['contact_email']) ? esc_attr($_POST['contact_email']) : ''; ?>">
            </div>

            <div class="form-group" style="margin-bottom: 15px;">
                <label for="contact_phone" style="display: block; margin-bottom: 5px; font-weight: bold;">Phone</label>
                <input type="tel" id="contact_phone" name="contact_phone" 
                       style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
                       value="<?php echo isset($_POST['contact_phone']) ? esc_attr($_POST['contact_phone']) : ''; ?>">
            </div>

            <div class="form-group" style="margin-bottom: 15px;">
                <label for="contact_subject" style="display: block; margin-bottom: 5px; font-weight: bold;">Subject *</label>
                <input type="text" id="contact_subject" name="contact_subject" required 
                       style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
                       value="<?php echo isset($_POST['contact_subject']) ? esc_attr($_POST['contact_subject']) : ''; ?>">
            </div>

            <div class="form-group" style="margin-bottom: 15px;">
                <label for="contact_message" style="display: block; margin-bottom: 5px; font-weight: bold;">Message *</label>
                <textarea id="contact_message" name="contact_message" rows="5" required 
                          style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; resize: vertical;"><?php echo isset($_POST['contact_message']) ? esc_textarea($_POST['contact_message']) : ''; ?></textarea>
            </div>

            <div class="form-group" style="margin-bottom: 20px;">
                <label for="contact_files" style="display: block; margin-bottom: 5px; font-weight: bold;">Attachments (Optional)</label>
                <input type="file" id="contact_files" name="contact_files[]" multiple 
                       accept=".pdf,.doc,.docx,.jpg,.jpeg,.png"
                       style="width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px;">
                <small style="color: #666;">Maximum file size: <?php echo esc_html($atts['max_file_size']); ?>MB. Allowed types: PDF, DOC, DOCX, JPG, PNG</small>
            </div>

            <button type="submit" class="contact-form-submit" 
                    style="background: #0073aa; color: white; padding: 12px 24px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px;">
                <?php echo esc_html($atts['submit_text']); ?>
            </button>
        </form>
    </div>
    <?php

    return ob_get_clean();
}
add_shortcode('contact_form_pro', 'professional_contact_form_shortcode');

Usage:

  1. Add this code to your theme's functions.php
  2. Use the shortcode: [contact_form_pro title="Get in Touch" submit_text="Send Message"]
  3. Files are automatically uploaded and attached to admin emails

🚀 WP LLM Benefits:

  • Professional Features: File uploads, validation, and notifications
  • Security First: Proper sanitization and file type validation
  • User Friendly: Clean, responsive design with error handling
  • Admin Ready: Email notifications with file attachments

🎨 Advanced Block Theme Examples

Example 3: Interactive Product Showcase Block

Business Need: Modern product showcase with filtering and lightbox gallery.

Traditional Approach: 8-12 hours of development WP LLM Approach: 20 minutes of prompt engineering

Prompt:

Create a Gutenberg block for product showcase with:
- Product grid layout with filtering by category
- Lightbox gallery for product images
- Price and stock status display
- Add to cart functionality
- Responsive design for mobile
- Customizable columns and spacing

Generated Code:

block.json:

json
{
  "apiVersion": 3,
  "name": "my-theme/product-showcase",
  "title": "Product Showcase",
  "category": "widgets",
  "icon": "grid-view",
  "description": "Interactive product showcase with filtering and lightbox gallery.",
  "attributes": {
    "title": { "type": "string", "default": "Our Products" },
    "category": { "type": "string", "default": "" },
    "columns": { "type": "number", "default": 3 },
    "productsPerPage": { "type": "number", "default": 9 },
    "showFilter": { "type": "boolean", "default": true },
    "showPrice": { "type": "boolean", "default": true },
    "showStock": { "type": "boolean", "default": true }
  },
  "supports": {
    "html": false,
    "align": ["wide", "full"]
  },
  "editorScript": "file:./edit.js",
  "style": "file:./style.css"
}

edit.js:

jsx
import { __ } from '@wordpress/i18n';
import { 
  useBlockProps, 
  RichText, 
  InspectorControls,
  PanelBody,
  SelectControl,
  RangeControl,
  ToggleControl
} from '@wordpress/block-editor';
import { 
  TextControl,
  Card,
  CardBody,
  CardHeader,
  CardMedia,
  Button,
  Badge
} from '@wordpress/components';
import { useState, useEffect } from '@wordpress/element';

export default function Edit({ attributes, setAttributes }) {
  const { 
    title, 
    category, 
    columns, 
    productsPerPage, 
    showFilter, 
    showPrice, 
    showStock 
  } = attributes;

  const [categories, setCategories] = useState([]);
  const [products, setProducts] = useState([]);

  useEffect(() => {
    // Fetch categories
    fetch('/wp-json/wp/v2/product_category')
      .then(response => response.json())
      .then(data => {
        const categoryOptions = data.map(cat => ({
          label: cat.name,
          value: cat.slug
        }));
        setCategories(categoryOptions);
      });

    // Fetch products
    fetch('/wp-json/wp/v2/product?per_page=6')
      .then(response => response.json())
      .then(data => setProducts(data));
  }, []);

  return (
    <div { ...useBlockProps() }>
      <InspectorControls>
        <PanelBody title={__('Product Showcase Settings', 'my-theme')}>
          <TextControl
            label={__('Title', 'my-theme')}
            value={title}
            onChange={(value) => setAttributes({ title: value })}
          />
          
          <SelectControl
            label={__('Category Filter', 'my-theme')}
            value={category}
            options={[
              { label: 'All Categories', value: '' },
              ...categories
            ]}
            onChange={(value) => setAttributes({ category: value })}
          />
          
          <RangeControl
            label={__('Columns', 'my-theme')}
            value={columns}
            onChange={(value) => setAttributes({ columns: value })}
            min={1}
            max={6}
          />
          
          <RangeControl
            label={__('Products per page', 'my-theme')}
            value={productsPerPage}
            onChange={(value) => setAttributes({ productsPerPage: value })}
            min={3}
            max={24}
          />
          
          <ToggleControl
            label={__('Show category filter', 'my-theme')}
            checked={showFilter}
            onChange={(value) => setAttributes({ showFilter: value })}
          />
          
          <ToggleControl
            label={__('Show price', 'my-theme')}
            checked={showPrice}
            onChange={(value) => setAttributes({ showPrice: value })}
          />
          
          <ToggleControl
            label={__('Show stock status', 'my-theme')}
            checked={showStock}
            onChange={(value) => setAttributes({ showStock: value })}
          />
        </PanelBody>
      </InspectorControls>

      <div className="product-showcase-block">
        <RichText
          tagName="h2"
          value={title}
          onChange={(value) => setAttributes({ title: value })}
          placeholder={__('Enter title...', 'my-theme')}
          className="product-showcase-title"
        />
        
        {showFilter && (
          <div className="product-filter">
            <SelectControl
              value={category}
              options={[
                { label: 'All Categories', value: '' },
                ...categories
              ]}
              onChange={(value) => setAttributes({ category: value })}
            />
          </div>
        )}
        
        <div 
          className="product-grid" 
          style={{ 
            display: 'grid', 
            gridTemplateColumns: `repeat(${columns}, 1fr)`,
            gap: '20px'
          }}
        >
          {products.map(product => (
            <Card key={product.id} className="product-card">
              <CardMedia>
                {product.featured_media ? (
                  <img 
                    src={product._embedded?.['wp:featuredmedia']?.[0]?.source_url || ''} 
                    alt={product.title.rendered}
                  />
                ) : (
                  <div className="no-image">No Image</div>
                )}
              </CardMedia>
              
              <CardHeader>
                <h3>{product.title.rendered}</h3>
                {showPrice && product.meta?.price && (
                  <span className="price">${product.meta.price}</span>
                )}
                {showStock && product.meta?.stock && (
                  <Badge 
                    variant={product.meta.stock > 0 ? 'success' : 'error'}
                  >
                    {product.meta.stock > 0 ? 'In Stock' : 'Out of Stock'}
                  </Badge>
                )}
              </CardHeader>
              
              <CardBody>
                <div 
                  dangerouslySetInnerHTML={{ 
                    __html: product.excerpt.rendered 
                  }} 
                />
                <Button 
                  variant="primary"
                  className="add-to-cart-btn"
                >
                  Add to Cart
                </Button>
              </CardBody>
            </Card>
          ))}
        </div>
      </div>
    </div>
  );
}

style.css:

css
.product-showcase-block {
  padding: 20px 0;
}

.product-showcase-title {
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.5rem;
  font-weight: 700;
  color: #333;
}

.product-filter {
  margin-bottom: 30px;
  text-align: center;
}

.product-grid {
  margin-top: 20px;
}

.product-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-card .no-image {
  width: 100%;
  height: 200px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.product-card h3 {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
  color: #333;
}

.product-card .price {
  font-size: 1.1rem;
  font-weight: bold;
  color: #0073aa;
  display: block;
  margin-bottom: 10px;
}

.add-to-cart-btn {
  width: 100%;
  margin-top: 15px;
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px;
  }
  
  .product-showcase-title {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr !important;
  }
}

🚀 WP LLM Benefits:

  • Modern React Components: Proper JSX and React patterns
  • Interactive Features: Filtering, lightbox, and responsive design
  • WordPress Integration: Seamless block editor integration
  • Production Ready: Complete with styling and mobile optimization

🚀 Ready to Transform Your WordPress Development?

These examples demonstrate the power of WP LLM's WordPress specialization. What would take hours or days with generic AI tools is accomplished in minutes with WP LLM.

Start building with WP LLM today:

Experience the difference that WordPress-specialized AI makes in your development workflow.