WordPress has a button in the editor for adding blockquotes to a post. But what if an author wants to add a citation? Unfortunately, it’s not possible without a little HTML knowledge.
This is a problem I’ve thought about a bit when designing DevPress themes (what markup should I be styling for?), but it’s also come up on a few client projects recently. Citations are a pretty common use-case, and it would be great if they were easier to add.
My solution was to build a plugin that replaces the existing TinyMCE button for blockquotes with an enhanced one.
I wrote this as a standalone plugin, but also as proof-of-concept for a core patch. If text is selected, it works exactly the same as the current blockquote button in the WordPress editor. However, if no text is selected, a pop-up modal is displayed with additional fields. These include: quote, citation, and citation link.
Everyone loves blockquotes with citations!
Right now the Better Blockquotes plugin is on GitHub. I’d love for other developers to review it and give me feedback. If no bugs turn up, I’ll submit it to the WordPress repository shortly.
I’m also curious if this is a feature people would even like to see in WordPress core? I’m not familiar enough with TinyMCE yet to understand how this sort of patch could be written, but get in touch if you’re interested! Or, tell me why it’s a bad idea.
Want the Better Blockquotes plugin right now? Download the latest version
This is really smart – I have a use in mind for it already and will give it a try. I’ve added formats and buttons to the MCE editor but never considered overriding a button that already exists.
I love to see this. I’d also add a class option, or a dropdown even, so someone can select “big fancy blockquote” or “big long blockquote”. I’d love to mix it up with blockquotes more, and sometimes make them big and decorative like an inline pullquote, and othertimes just for actual large blocks of text.
Great work! I’d probably install this as soon as you release it :)
I was thinking “alignment” would be useful. A filterable dropdown of “styles” would also be great. Both would require implementation by a theme by a theme though.
I could have these drop-downs turned off by default, and activate only if there an add_theme_support call or the fields have a filter applied.
Good suggestion Krogsgard.
Screenshot looks promising ;) Cool idea, I’ll go check out that code!
I’ve just installed but I can’t seem to make it work…all I’m getting is the same tinymce blockquote…
Make sure you’re in the “Visual” mode vs. the “Text” mode if you’re using the Classic Editor. If you’re using the new default editor (Gutenberg) the quote block has this functionality built in- no plugin needed.