WPBookList has quite a few shortcode options available for displaying books on your website, but keeping them all straight is a little confusing – luckily you’ve just stumbled across the Ultimate WPBookList Shortcode Guide!
Available Shortcode Arguments
Below is a list of all available arguments that can be included in the shortcode:
The most basic usage of the WPBookList’s ‘showbookcover’ shortcode is the shortcode with one single argument – the ISBN or ASIN number of the book you’d like to display.
This shortcode will display the book ‘Guns, Germs, and Steel’ from my default library. Here’s how the book will actually end up looking by using the above shortcode:
There are 4 things to cover here with this [showbookcover isbn="9780393061314"] shortcode:
- The Alignment
- The Width
- The Action
- The Display
By default, the shortcode will display a book Aligned to the left side of the page, with a Width of 100, with a default Display of “justimage” (meaning just the cover image is shown) and the Action of “Bookview”, meaning that when you click on the cover image, the Book View of the book will be displayed. Also, as you can see, any text placed on the page around the shortcode will wrap around the cover image.
Setting the Table Argument
Say I’ve got two custom libraries – a ‘Fiction’ and a ‘Non-fiction’ library, with two separate, corresponding pages for each. Obviously on the ‘Non-fiction’ page I’d want to display books from my ‘Non-fiction’ library. Simply include the table argument with the name of the table itself, like so:
[showbookcover isbn="9780143122012" table="nonfiction"]
Just as a side note, while WPBookList should handle things for you automatically, when creating custom libraries, it’s best to name them simply, keep the names all lowercase, and don’t use any special characters, like a dash or an underscore.
Setting Alignment and Width
Let’s say you want that ‘Guns, Germs, and Steel’ book on the right side of your page, with a width of, say, 200. Here’s the shortcode that would do that:
[showbookcover isbn="9780393061314" align="right" width="200"]
And to your right is the result! The book is Aligned to the right side of the page, is twice as large as the book cover above (100 versus 200), has a Display of “justimage”, and still has the default Action of “Bookview”. To move this book back to the left side with a width of 100, then either completely remove the align=”right” and width=”200″ arguments, or specify the alignment and width, like so: [showbookcover isbn="9780393061314" align="left" width="100"]
Setting the Action Argument
Let’s say you don’t want the “Book View” opening when clicking on the book cover, but instead want your visitor taken to a website where the title is sold. Simply include the Action argument in your shortcode, specifying which merchant you want your visitor directed to.
Let’s say I want my website’s visitors taken to the Amazon page of the book below. Here’s the shortcode and the resulting book:
[showbookcover isbn="B003V8B5XO" action="amazon"]
Go ahead – click on the book cover. You should have been taken to the Amazon page for Atlas Shrugged. To direct your visitors to other merchants that may be selling this title, simply replace the ‘amazon’ in the shortcode above with any of the following:
Setting the Display Argument
Ok, so let’s say you want to provide a little more that just a book’s cover image to your visitors. Here’s where the Display argument comes in. There’s only two options here – display=”justimage” and display=”excerpt”. Check out the book below, which uses this shortcode:
[showbookcover width="200" isbn="9780061452055" display="excerpt"]
The display=”justimage” display argument shows not only the book cover, but the title, an excerpt (pulled from the book’s ‘Description’ field), and the purchase links. There’s several things to go over here, including:
- The Alignment
- The Width
- The Action
All of the other shortcode arguments still apply – you can see that everything is aligned to the left, the width of the image is 150 (which is actually a little larger than the default image size when using display=”justimage” or just leaving out the display argument altogether), and the action is set to the default “Book View”.
Let’s go crazy here and change things up, using this shortcode:
[showbookcover isbn="9781451648539" display="excerpt" align="right" width="200" action="amazon"]
Here we can see that we’ve aligned the book to the right (which aligns everything except the cover image – that’ll always stay on the left side), we’ve increased the image’s size a bit from 150 to 200, and we’ve specified that the action taken when clicking on the cover image is to direct the visitor to Amazon.
Congratulations – you’re now a Shortcode Expert! Feel free to experiment with the shortcode and it’s options – mix and match sizes, alignments, actions, and displays to get things just right for your particular website.
Be sure to check out all of the available WPBookList Extensions and WPBookList StylePaks. Also, if you find yourself bored, lonely, without a purpose in life, or, ya know, just generally hopeless, feel free to leave WPBookList a 5-Star Review – it’s a scientific fact that doing nice things makes you feel good!
Thanks for using WPBookList!