Home Blog Blockquotes with WordPress Shortcode

Blockquotes with WordPress Shortcode


Virtually all WordPress themes will style their blockquotes in a specific manner – not always to your liking. While it’s super-simple to write some custom CSS and overwrite the default behaviour, our shortcode will permit you to preserve the theme-specific style and use another for basic text. The function supports nested shortcodes, meaning that you can use shortcodes inside the blockquote. The code isn’t completely unlike our textbox shortcodes… apart from the fancy-pants formatting.

Again, using CSS is almost always a better means of formatting your page. There are times, however, where this might be useful.

The Result

In its most simplest form, a shortcode of [blockquote]Your content in here…[/blockquote] will generate the following. For the sake of the example we’ll include a random quote (generated with shortcode of [qotz]).

"It is truer to say that martyrs create faith more than faith creates martyrs." — Miguel de Unamuno 

The Code

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Shortcode Attributes

Following attributes alter the blockquote presentation.


The width of the blockquote. Can be a percentage or pixel width. If none provided, defaults to pixels.


To preserve some semblance of a blockquote when used on some mobile devices, the blockquote will only scale to the maxwidth (90% seems to be okay)


Applies a small padding to the blockquote. We apply 5 pixels by default.



Title: Blockquotes with WordPress Shortcode
Description: Renders a blockquote in WordPress with shortcode.
Download: Shortcode (V0.2) | WP Plugin (V0.2) | | Plugin Page

Shortt URL for this post: http://shor.tt/1XO0


Please enter your comment!
Please enter your name here