Title: Add quotes using shortcode
Last modified: August 20, 2016

---

# Add quotes using shortcode

 *  Resolved [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/)
 * I would like the ability to add opening and ending quotes ‘<q></q>’ using a shortcode.
 * I know shortcodes cannot add curling q’s to quoted text, but all I want this 
   shortcode to do is to wrap selected text in <q> brackets.
 * So, in a View Page Source DOM, text would look like…
 * <p><q>this would be the quoted text</q></p>
 * Reasons why…browsers today auto-add the curly q’s upon seeing <q>, and search
   engines recognize them as specific quoted text, giving them more weight than 
   just using a class to create the affect.
 * As far as why creating a shortcode…I can had one simple button to TinyMCE, then
   I can highlight the text and click the respective button to add the <q> brackets.

Viewing 6 replies - 16 through 21 (of 21 total)

[←](https://wordpress.org/support/topic/add-quotes-using-shortcode/?output_format=md)
[1](https://wordpress.org/support/topic/add-quotes-using-shortcode/?output_format=md)
2

 *  Thread Starter [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368702)
 * Yeah, much better, however, <p> should still wrap around the quoted text.
 * Using the example above again…
 * [inline-quotes]Content here.[/inline-quotes]
 * The page source result…
 * <q>Content here.</q>
    <p>next paragraph</p>
 * It should result in…
 * <p><q>Content here.</q></p>
    <p>next paragraph</p>
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368728)
 * So
 *     ```
       function quote_func($atts, $content = null) {
            return '<q><p>' . $content . '</p></q>';
       }
       add_shortcode('inline-quotes', 'quote_func');
       ```
   
 * Except NOW you’re not able to do it ‘inline’ anymore, per your example. You can’t
   do `This is me. [inline-quote]This is Bob[/inline-quote] This is me again.’ Which
   was your example.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368740)
 * Shouldn’t that be:
 *     ```
       function quote_func($atts, $content = null) {
            return '<p><q>' . $content . '</q></p>';
       }
       add_shortcode('inline-quotes', 'quote_func');
       ```
   
 * > Except NOW you’re not able to do it ‘inline’ anymore, per your example.
 * Agreed – ‘cos now you’ve introduced a block-level element. If this is for your
   clients, then they’re going to have to learn to use 2 buttons/shortcodes – 1 
   for inline quotes and 1 for block quotes. And the latter is identical to `<blockquote
   ></blockquote>` – which means that we’ve come full circle.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368755)
 * Er right, p then q.
 * And the full circle thing too 🙂
 *  Thread Starter [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368759)
 * Okay, I should have tested the previous code on my example above, however, I 
   just tried wrapping it around the complete paragraph for testing. So, I went 
   back and just added it to the partial content to be in quotes, and the previous
   code worked. It wrapped the to-be quoted content in <q>, and the entire paragraph
   in <p>.
 * For inline, assuming partial of a paragraph, the following code works:
 *     ```
       function quote_func($atts, $content = null) {
            return '<q>' . $content . '</q>';
       }
       add_shortcode('inline-quotes', 'quote_func');
       ```
   
 * One last thing…when I apply the shortcode via button, it only produces one [inline-
   quotes]; the end, [/inline-quotes], is not produced. I notice there is </q> added
   to the code above, but it does not seem to be functioning.
 * Thanks for the help.
 *  Thread Starter [cableghost](https://wordpress.org/support/users/cableghost/)
 * (@cableghost)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368940)
 * I actually found a better solution, thanks to input and threads found on stackexchange
   and stackoverflow.
 * #1 Install TinyMCE plugin
 * #2 Create shortcode(s), if needed: [wordpress-shortcode-tutorial-simple-to-advanced-part-1](http://www.tutorialchip.com/wordpress/wordpress-shortcode-tutorial-simple-to-advanced-part-1/)
 * #3 Add Functions.php code: [how-do-i-add-a-tinymce-row-that-all-users-can-see-instead-of-just-admins](http://wordpress.stackexchange.com/questions/27914/how-do-i-add-a-tinymce-row-that-all-users-can-see-instead-of-just-admins)
 * #4 Create JS file: [#5 of wordpress-shortcode-tinymce-button-tutorial-part-2](http://www.tutorialchip.com/wordpress/wordpress-shortcode-tinymce-button-tutorial-part-2/)

Viewing 6 replies - 16 through 21 (of 21 total)

[←](https://wordpress.org/support/topic/add-quotes-using-shortcode/?output_format=md)
[1](https://wordpress.org/support/topic/add-quotes-using-shortcode/?output_format=md)
2

The topic ‘Add quotes using shortcode’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 21 replies
 * 3 participants
 * Last reply from: [cableghost](https://wordpress.org/support/users/cableghost/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/add-quotes-using-shortcode/page/2/#post-2368940)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
