Embed Google Books in Your Posts Using Shortcode

Add Tool

Embed Google Books in Your Posts Using Shortcode


Embed Google Books in Your Posts Using Shortcode

Many learners want to collect book from Google books. So you can embed Google books in your posts using shortcode in your WordPress site very easily. Especially some clients give task to their web developer to display Book from Google book. You can display this Google book by using WordPress plugin. But some clients want to avoid using plugin. Here we will use some PHP codes in our functions.php file which will let you use shortcode to embed Google books in your WordPress post content.

Please add the following codes below in your themes functions.php file

<?php
add_shortcode('gbooks', 'sc_embed_google_books');
function sc_embed_google_books( $atts ){
extract(shortcode_atts(array(
 "id" => '',
 "width" => '500',
"height" => '700',
), $atts));
return '<script type="text/javascript" src="http://books.google.com/books/previewlib.js"></script>
        <script type="text/javascript">
        GBS_insertEmbeddedViewer("'.$id.'", '.$width.','.$height.');
        </script>';
}
?>

Embed Google books in your posts using shortcode

Now we will add the below shortcode with our content where Google books will be displayed.

[gbooks id="1234521452" width="400" height="400"]

Here our Google book id="1234521452" This Google Books Id you will find from Google books ISBN.

Learn more about WordPress Shortcode


Tags: Google books, Google play books, Google book, Google chrome book, Google books free, Google books in WordPress
Payza

About Masum Billah

Embed Google Books in Your Posts Using Shortcode 1stWebSuite website seo tool is a free website ranking tool site provides a lot of on page and off page seo useful tools for you. On this site, we have a large number of website ranking tools


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: Embed Google Books in Your Posts Using Shortcode


adf.ly