Skip to content

whyisjake/placeholders

Repository files navigation

Placeholders

Tests WordPress Plugin Version WordPress Plugin: Tested WP Version License

A WordPress plugin that provides Gutenberg blocks for common ad placeholder sizes.

Description

Placeholders adds 14 customizable Gutenberg blocks for standard advertising sizes. Perfect for wireframing, prototyping, or reserving space for future ad placements.

Available Block Sizes

  • Leaderboard - 728×90px
  • Medium Rectangle - 300×250px
  • Wide Skyscraper - 160×600px
  • Mobile Banner - 320×50px
  • Billboard - 970×250px
  • Large Rectangle - 336×280px
  • Half Page - 300×600px
  • Small Square - 200×200px
  • Square - 250×250px
  • Small Rectangle - 180×150px
  • Vertical Rectangle - 240×400px
  • Large Leaderboard - 970×90px
  • Portrait - 300×1050px
  • Netboard - 580×400px

Installation

From WordPress.org

  1. Go to Plugins → Add New in your WordPress admin
  2. Search for "Placeholders"
  3. Click Install Now and then Activate

Manual Installation

  1. Upload the placeholders folder to /wp-content/plugins/
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. In the block editor, search for any ad size (e.g., "Leaderboard") in the inserter

Usage

  1. Open any post or page in the block editor
  2. Click the '+' button to add a new block
  3. Search for an ad size (e.g., "leaderboard", "medium rectangle")
  4. Insert the block
  5. Customize the background and text colors using the block settings panel

Features

  • ✅ 14 standard IAB ad sizes
  • ✅ Customizable background and text colors
  • ✅ Support for wide and full alignment
  • ✅ Responsive design
  • ✅ Clean, minimal styling
  • ✅ Shows dimensions and ad name
  • ✅ Grouped in dedicated "Placeholders" category

Development

The plugin uses WordPress Block API version 3 and follows modern WordPress development best practices.

File Structure

placeholders/
├── .github/
│   └── workflows/
│       ├── deploy-to-wordpress-org.yml
│       ├── asset-update.yml
│       └── test.yml
├── .wordpress-org/          # WordPress.org plugin assets
├── bin/
│   └── install-wp-tests.sh
├── blocks/
│   ├── leaderboard/
│   │   └── block.json
│   ├── medium-rectangle/
│   │   └── block.json
│   └── [12 other ad sizes]/
│       └── block.json
├── tests/
│   ├── jest/
│   │   ├── blocks.test.js
│   │   └── setup.js
│   └── phpunit/
│       ├── bootstrap.php
│       ├── Test_Plugin.php
│       └── Test_Blocks.php
├── .gitignore
├── blocks.js                # Client-side block registration
├── composer.json            # PHP dependencies
├── composer.lock
├── editor.css              # Editor styles
├── jest.config.js          # Jest configuration
├── LICENSE.txt             # GPL v2 license
├── package.json            # Node dependencies
├── package-lock.json
├── phpunit.xml.dist        # PHPUnit configuration
├── placeholders.php        # Main plugin file
├── readme.txt              # WordPress.org readme
├── README.md               # GitHub readme
└── style.css               # Frontend styles

Local Development

# Clone the repository
git clone https://github.com/whyisjake/placeholders.git

# Install dependencies
npm install

# Symlink to your local WordPress installation
ln -s /path/to/placeholders /path/to/wordpress/wp-content/plugins/placeholders

Testing

The plugin includes both PHPUnit tests for PHP code and Jest tests for JavaScript.

JavaScript Tests (Jest)

# Run Jest tests
npm run test:unit

# Run tests in watch mode
npm run test:unit:watch

# Run tests with coverage
npm run test:unit:coverage

PHP Tests (PHPUnit)

First, install the WordPress test suite:

# Install Composer dependencies
composer install

# Install WordPress test suite
bin/install-wp-tests.sh wordpress_test root '' localhost latest

# Run PHPUnit tests
vendor/bin/phpunit

# Run specific test file
vendor/bin/phpunit tests/phpunit/Test_Blocks.php

# Run with verbose output
vendor/bin/phpunit --verbose

Linting

# Lint JavaScript
npm run lint:js

# Lint CSS
npm run lint:css

# Lint everything
npm run lint

# Auto-fix formatting
npm run format

Continuous Integration

The plugin uses GitHub Actions for automated testing. Tests run automatically on:

  • Every push to the main branch
  • Every pull request

The CI pipeline tests against:

  • PHP versions: 8.1, 8.2, 8.3
  • WordPress versions: latest, 6.7, 6.6
  • PHPUnit: 9.x (WordPress compatible)

Deployment to WordPress.org

This plugin uses GitHub Actions for automated deployment to WordPress.org.

Setup

  1. Add your WordPress.org SVN credentials as GitHub secrets:

    • SVN_USERNAME: Your WordPress.org username
    • SVN_PASSWORD: Your WordPress.org password
  2. To deploy a new version:

    # Update version in placeholders.php and readme.txt
    # Commit changes
    git add .
    git commit -m "Bump version to 1.1.0"
    
    # Create and push a tag
    git tag 1.1.0
    git push origin main --tags
  3. The GitHub Action will automatically deploy to WordPress.org

Assets

Place plugin assets in the .wordpress-org/ directory:

  • banner-772x250.png - High resolution banner
  • banner-1544x500.png - Retina banner
  • icon-128x128.png - Small icon
  • icon-256x256.png - Large icon
  • screenshot-1.png - Screenshot 1
  • screenshot-2.png - Screenshot 2
  • etc.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

GPL v2 or later

Author

Jake Spurlock

Support

Changelog

1.0.0

  • Initial release
  • 14 ad placeholder blocks
  • Color customization support
  • Alignment support
  • Custom "Placeholders" block category

About

A WordPress plugin that provides Gutenberg blocks for common ad placeholder sizes.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors