# Block Pattern: Plan Comparison Table

> Adds a comparison table pattern with a header row and check marks for comparing plans, products or options side by side.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: patterns, table, comparison, pricing
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/pattern-comparison-table/

## Code

```php
add_action( 'init', function () {
    if ( ! function_exists( 'register_block_pattern' ) ) {
        return;
    }

    if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( 'wpide-sections' ) ) {
        register_block_pattern_category( 'wpide-sections', array( 'label' => 'Site Sections' ) );
    }

    $rows = array(
        array( 'Websites', '1', '5', 'Unlimited' ),
        array( 'Daily backups', '&#x2714;', '&#x2714;', '&#x2714;' ),
        array( 'Priority support', '&mdash;', '&#x2714;', '&#x2714;' ),
        array( 'White-label reports', '&mdash;', '&mdash;', '&#x2714;' ),
    );

    $body = '';
    foreach ( $rows as $row ) {
        $body .= '<tr><td>' . implode( '</td><td>', $row ) . '</td></tr>';
    }

    $content = '<!-- wp:table {"hasFixedLayout":true} --><figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Feature</th><th>Starter</th><th>Growth</th><th>Agency</th></tr></thead><tbody>' . $body . '</tbody></table></figure><!-- /wp:table -->';

    register_block_pattern( 'wpide/comparison-table', array(
        'title'       => 'Comparison table: three plans',
        'description' => 'Feature rows compared across three plans.',
        'categories'  => array( 'wpide-sections' ),
        'keywords'    => array( 'comparison', 'table', 'plans', 'features' ),
        'content'     => $content,
    ) );
} );
```

## Notes

Edit cells directly in the table after inserting. Pair it with the "Lined" or "Hover rows" table styles.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Block Pattern: Plan Comparison Table" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
