Perfect Quotes – a WordPress plugin
Recently a family member asked me to help set up a WordPress site so they could start blogging and share with the world their thoughts about life. One of the things requested was a plugin that would allow them to put a quote they liked onto the sidebar. It seemed like a simple enough request. So I headed off to wordpress.org to look at their vast plugin library.
What started out as a simple plugin request, turned out to be somewhat of a disheartening dead end. Don’t get me wrong; there are tons of quote plugins out there. I just wasn’t able to find anything that was simple and straight forward.
Most of the plugins pulled quotes from external websites and displayed random quotes. Others were poorly written and confusing to implement, much less use. Here is what I wanted: to enter whatever quote I want, to add an author or source of the quote, and to show that quote where I want, when I want, and how I want. And then I had a thought, “I’ll just make it myself!”. And Perfect Quotes was born.
About Perfect Quotes
Perfect Quotes is a simple plugin designed to do only one thing: to display your quote where you want it, nothing more, nothing less. It is built around custom post types, which allows every quote you ever have added to be archived in the WordPress database. You’ll never wish you could remember that one quote, it’s still there! It has a widget function, so you can put the quotes on the sidebar of your site, or maybe the footer. It also has a shortcode which allows you to place whichever quote you want into and blog post or page you want! Let’s get started and put your quotes onto your site!
Perfect Quote Plugin Installation
The easiest way is to navigate in your WordPress admin area to Plugins > Add New. In the plugin search bar type in “Perfect Quotes” and press enter. Once you locate the plugin, install it. It will automatically download the plugin into your WordPress application. When it is complete, click Activate Plugin and your on your way!
How to write a Perfect Quote
You will notice a new menu at the bottom of the left hand menu that looks like this
Click on Add new and you will be taken to a new page where you can add your quote. Type in your new quote like this:
If you want to add an author or source for you quote you will need to use what is called a custom field. In the Name field type in “perfect_quote_author”. And in the Value field type in the name of the author or source. Then click Add Custom Field. Enter the info like this:
Once that is complete we are ready to save the quote. You can also have this post publish at a later date if you so choose, or you can save it as a draft. Your choice. Whatever you choose, click either the Save Draft button or the Publish button when you are done.
You have now entered your first quote. I am sure it won’t be your last!
The Perfect Quotes Widget
If you want to add the widget to your sidebar or other area on your site, follow the instructions here to accomplish just that. First you will want to navigate to the Widgets area. Look at this menu to see what I mean:
Once in the the Widgets area, drag the Perfect Quotes widget from the main area to the sidebar or area of you choice. For this example, I dragged it to the Main Sidebar.
After you have placed it in the area you chose, click the down arrow on the right side of the widget to show a few options. You can give it a title of your choice. If you leave it blank, it will default to Perfect Quotes.Here you can see I chose to title mine My Quotes. You can also enter how many quotes you want displayed at a time. The default for this is only one quote. Keep in mind, that this widget will always grab the newest quote first and work its way back. Then click Save and go view your site!
Here is what the finished Perfect Quotes widget looks like on the site.
Perfect Quotes Shortcode
What is a shortcode you might ask? It is a simple “code” or set of instructions that WordPress understands and which tells WordPress to do something. In this case, we are going to tell WordPress to grab a particular quote so we can show it in a post or on a page.
It is really quite simple. On the Perfect Quotes custom post overview page, find the quote you are looking for. Then locate the column title Shortcode and copy the corresponding short code. It should look something like [perfect_quotes id="54"].
Once you have copied this, take it over to the post or page of your choice, or add a new post or page, then paste the shortcode where you would like it to appear.
Then Update or Publish your post or page, and go view it to see how it looks!
Congratulations! That’s all there is to it! Happy Perfect Quoting!













Is there a way to add a hyperlink to each quote so that when you click on a particular quote it goes to the corresponding blog post or book review in which the quote is found? That’s a step beyond just listing the title of the book or essay in the “where” field, I assume? Thanks!
Great plugin…
Latest version of plugin has stopped saving the ‘Author’ and ‘Where the quote is from’ It does not work as add or updates to the quote.
This needs to be fixed … it’s stopping me from adding new quotes!!
Thanks
Indy
In either the author or where location (or the title for that matter) you could put something like
That should work just fine. If it doesn’t, then some backend code would need to be hacked. Doesn’t that sound fun?!
The most recent update to the plugin will not save the author or where the quote is from information, and has stripped the formatting of all quotes. Please fix ASAP!
This plugin seems great but it is not working the way this page describes it. There are no formatting options and it does not appear the way that your examples do! Please fix!
If you could give me some more information as to what you are talking about that would be helpful. It is possible that some previously installed plugins are causing the issues. What plugins do you currently have installed and what version of WordPress are you running?
The widget is throwing an error in the categories selection:
Warning: in_array() expects parameter 2 to be array, null given in /xxx/wp-content/plugins/perfect-quotes/includes/widget.php on line 156
I found that this was causing problem:
foreach ($terms as $term) {
$selected = (in_array($term->term_id, $cat)) ? ‘ selected’ : ”;
echo ‘term_id . ‘”‘ . $selected . ‘>’ . $term->name . ”;
}
I fixed it like this:
foreach ($terms as $term) {
/*$selected = (in_array($term->term_id, $cat)) ? ‘ selected’ : ”;*/
echo ‘term_id . ‘”>’ . $term->name . ”;
}
Thanks for the debug. I couldn’t recreate the issue on my localhost, but I did add a fix. Instead of doing your proposed changes, on line 135 I changed the second value in the ternary from null to array() like this:
I will commit this fix soon us an updated plugin. Thanks for the help!
this is a great plugin, how would i make the font of the quote larger, and make the author of the quote bold?
For the quote text to be larger you would need to add something like the following to your theme’s css file:
And as of yet, there isn’t a way to style the size of just the author text without messing with the location text. However, you could enter the following into the author field:
Brandon, love the look of this plugin, but cannot get it to display more than one quote. I input ’4′ in Number of quotes to show box, but no joy. Can you please help? (note: I’m not HTML/CSS literate…) cheers!
It is possible that there is a bug or that there is a conflict with some other installed plugins. I will look at the code and see if I can recreate the issue. Also would you mind sending me a list of plugins that you are using?
Brandon,
Thx for yr quick response. I tried deactivating ALL of my plugins (except PQ), but alas, no joy–still just only one quote displayed. I should also note that I have ‘Hide on checked’ selected for two of my pages (Home and Featured Projects, which have checks in the appropriate boxes as well) and that feature is functioning properly. Otherwise, everything has been left as-is (defaults). My plugins are: Akismet, Broken Link Checker, Clean Notifications, Display widgets, Easy Theme and Plugin Upgrades, Fast Secure Contact Form, Google XML Sitemaps, Jetpack by WordPress.com, No Self Pings, Perfect Quotes, SI CAPTCHA Anti-Spam, Social Media Widget, Weaver II Maintenance, Weaver II Theme Extras, WordPress Backup to Dropbox, WordPress SEO.
I added my first quote and was ecstatic! This is what I have wanted, but never looked for a plugin until the other night.
The quote looks great on the computer, but when I pull up my blog post on the browser on my iPad and on the feedly app on my iPad the quote does not show up. Is there a setting I can change to make this work?
http://www.joyceglass.org/2013/04/10/when-i-am-weak/
Thanks!
OK, it’s been a week, can you provide any help at all?
My quote appears flush left, it doesn’t indent – any ideas?
I have noticed that all of the quotes I’ve added are given separate pages, but the quote authors are not included on those pages! The result is when someone searches for the quote on Google and finds my page, it appears as though I am crediting myself with having said it?
I need a way to either (a) turn off pages for Perfect Quotes or (b) make the individual pages list the author of the quote.
Example: http://peterbeddow.org/perfect-quotes/right-is-right-even-if-no-one-is-doing-it-wrong-is-wrong-even-if-everyone-is-doing-it/
(St. Augustine said that, not me!)
Otherwise, I LOVE this plugin. Many thanks for making it.
Pete
Deonna,
You most likely have some sort of style in your theme over-riding the default style of the plugin. You’d have to get in a adjust the css in your theme’s style.css file.
I honestly don’t know why it isn’t showing, but doing things on the iPad can have differing results on the websites. Especially if the site is responsive and the plugin is within some block that is design to hide on an iPad. There’s not much I can help you with without actually digging in to your site.
Peter,
The only way that I know of to help with this is to create a custom post template for Perfect Quotes. This is an idea, that until now, has escaped me. I will include this in the next release of the plugin.
Hello Brandon
I really like your plugin, but beyond that it’s beautifully coded. Well done on that part and eager to see the updated version per your discussion with Peter.
My small contribution, you got a typo on line 64 of post-type.php.
“pefect-quotes-categories” => “perfect-quotes-categories”
Besides that, I’ll probably steal a little bit of your code (for a completelly different project) and credit you. It seems ok GPL-wise, but just to let you know !
All the best
Greg
Brandon,
How refreshing it is that you are so responsive to your clients. Is there a way to donate money to ts project? I am encouraged by the dedication here.
Do you have an expected date for the next release?
Brandon,
Another quick note. I noticed that for every regular post created when Perfect Quote is activated, “perfect_quote_author” and “perfect_quote_where” will be systematically added to the wp_postemeta table.
It looks unnecessary to me and -overt time- could tax the DB weight. I’m probably naive here but is this a standard practice ?
Cheers
Greg
Greg,
Thank you so much for your kind words. We at Perfect Space try to create as clean of code as possible. It takes a little extra work on our part, which most people never notice, but it creates a great sense of pride in something beyond just how it looks to the end user.
Thanks for the typo fix. I have fixed the code in the plugin. I’m not releasing it yet, though, as I have several new things in the works!
Peter,
I very much appreciate your enthusiasm and desire to help out. I need to talk to the guys and see if we have anything setup currently for donations.
I don’t have an expected release date for the next iteration of the plugin. Keep your eyes peeled though!
Greg,
A great question and concern. I honestly didn’t know that that was being added for all regular posts. That seems a little counter-intuitive seeing as how I have created my own post type for this plugin. I will dig in a see what I come up with. Thanks for the heads up!
I have 2 new “spam” quotes that appeared on a website of mine. They don’t appear in the Dashboard, they’re just appearing on the website. Must have been hacked. What can be done?