Do you want to use shortcode to embed Google books in your WordPress posts? While there’s probably a plugin for this, we have created a quick code snippet that you can use to embed Google books in your posts using shortcodes in WordPress.
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
You will also notice that some Google books have multiple ISBN numbers like
0578022702, 9780578022703. Both can work with the shortcode, but you should grab the first one before the comma. If the book does not have an ISBN number, then you can get the ID from the URL.
This is the shortcode that you can use to display Google books in your posts. Simply replace the ISBN number or ID and add your Google book ISBN number.
[gbooks id="0578022702" width="400" height="400"]
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 9 best WordPress accordion plugins and how to set up download tracking in WordPress with Google Analytics.