# Pull Quote Shortcode

> Adds a [pull_quote] shortcode that sets a short quotation in large type, floated to the side on wide screens and full width on phones, to break up long articles.

- Type: PHP
- Runs: Run everywhere
- Category: [Content](https://wpide.com/library/category/content/)
- Tags: shortcodes, quotes, typography
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/pull-quote-shortcode/

## Code

```php
add_action( 'init', function () {
    wp_register_style( 'wpide-pullquote', false, array(), '1.0' );
    wp_add_inline_style( 'wpide-pullquote', '.wpide-pullquote{margin:1.5em 0;padding:.5em 0 .5em 1em;border-left:4px solid currentColor;font-size:1.35em;line-height:1.4;font-style:italic}.wpide-pullquote p{margin:0}.wpide-pullquote cite{display:block;margin-top:.5em;font-size:.7em;font-style:normal;opacity:.8}@media (min-width:700px){.wpide-pullquote.is-left{float:left;width:40%;margin:.3em 1.5em 1em 0}.wpide-pullquote.is-right{float:right;width:40%;margin:.3em 0 1em 1.5em}.wpide-pullquote.is-center{text-align:center;border-left:0;border-top:3px solid currentColor;border-bottom:3px solid currentColor;padding:.75em 0}}' );

    add_shortcode( 'pull_quote', function ( $atts, $content = '' ) {
        $atts  = shortcode_atts( array( 'align' => 'right', 'cite' => '' ), $atts, 'pull_quote' );
        $align = in_array( $atts['align'], array( 'left', 'right', 'center' ), true ) ? $atts['align'] : 'right';
        wp_enqueue_style( 'wpide-pullquote' );

        return sprintf(
            '<blockquote class="wpide-pullquote is-%s"><p>%s</p>%s</blockquote>',
            esc_attr( $align ),
            wp_kses( trim( $content ), array( 'em' => array(), 'strong' => array(), 'br' => array(), 'a' => array( 'href' => true ) ) ),
            '' !== $atts['cite'] ? '<cite>&mdash; ' . esc_html( $atts['cite'] ) . '</cite>' : ''
        );
    } );
} );
```

## Notes

Example [pull_quote align="right" cite="Jane Doe"]Great design is invisible.[/pull_quote]; align can be left, right or center.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Pull Quote Shortcode" 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/
