Halloween Sale 15% off Ends in See the plans
PHP

Extra Block Styles: Card, Pill Button, Shadow Image and Checklist

Adds four ready-made style options to the block editor: a card style for Group blocks, a pill style for buttons, a soft shadow for images and a checkmark style for lists.

Don’t have WPIDE yet? Install it on your site

Code

add_action( 'init', function () {
    register_block_style( 'core/group', array(
        'name'         => 'wpide-card',
        'label'        => 'Card',
        'inline_style' => '.wp-block-group.is-style-wpide-card{padding:1.5em;border-radius:10px;background:#fff;color:#1d2327;box-shadow:0 2px 12px rgba(0,0,0,.08);}',
    ) );

    register_block_style( 'core/button', array(
        'name'         => 'wpide-pill',
        'label'        => 'Pill',
        'inline_style' => '.wp-block-button.is-style-wpide-pill .wp-block-button__link{border-radius:999px;padding-left:1.75em;padding-right:1.75em;}',
    ) );

    register_block_style( 'core/image', array(
        'name'         => 'wpide-shadow',
        'label'        => 'Soft shadow',
        'inline_style' => '.wp-block-image.is-style-wpide-shadow img{border-radius:6px;box-shadow:0 10px 30px rgba(0,0,0,.18);}',
    ) );

    register_block_style( 'core/list', array(
        'name'         => 'wpide-checklist',
        'label'        => 'Checklist',
        'inline_style' => '.wp-block-list.is-style-wpide-checklist{list-style:none;padding-left:0;}.wp-block-list.is-style-wpide-checklist li::before{content:"\2713";margin-right:.6em;color:#00a32a;font-weight:700;}',
    ) );
} );

Notes

Pick the styles in the block sidebar under Styles. Edit the CSS in each inline_style to match your design.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.