# Block Pattern: Call to Action With Two Buttons

> Adds a centered call-to-action pattern with a heading, a sentence and a main button plus an outline button, for the end of landing and service pages.

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

## 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' ) );
    }

    $content = '<!-- wp:group {"layout":{"type":"constrained"}} --><div class="wp-block-group">'
        . '<!-- wp:heading {"textAlign":"center"} --><h2 class="wp-block-heading has-text-align-center">Ready when you are</h2><!-- /wp:heading -->'
        . '<!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center">Start your free 14-day trial. No credit card needed.</p><!-- /wp:paragraph -->'
        . '<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} --><div class="wp-block-buttons">'
        . '<!-- wp:button --><div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="#">Start free trial</a></div><!-- /wp:button -->'
        . '<!-- wp:button {"className":"is-style-outline"} --><div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="#">Talk to sales</a></div><!-- /wp:button -->'
        . '</div><!-- /wp:buttons --></div><!-- /wp:group -->';

    register_block_pattern( 'wpide/cta-two-buttons', array(
        'title'       => 'Call to action: two buttons',
        'description' => 'Centered heading, text and two buttons.',
        'categories'  => array( 'wpide-sections', 'call-to-action' ),
        'keywords'    => array( 'cta', 'signup', 'buttons' ),
        'content'     => $content,
    ) );
} );
```

## Notes

Set a background color on the Group block after inserting to make the section stand out.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Block Pattern: Call to Action With Two Buttons" 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/
