pustakakoran

Kode-kode Wordpress SNIPS

Oct 15th, 2017
72
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. http://wpsnipp.com/index.php/functions-php/embed-google-books-in-your-posts-using-shortcode/
  2.  
  3. How to Embed Google books in your posts using shortcode
  4.  
  5.  
  6. Copy in function.php:
  7. add_shortcode('gbooks', 'sc_embed_google_books');
  8. function sc_embed_google_books( $atts ){
  9. extract(shortcode_atts(array(
  10. "id" => '',
  11. "width" => '600',
  12. "height" => '900',
  13. ), $atts));
  14. return '<script type="text/javascript" src="http://books.google.com/books/previewlib.js"></script>
  15. <script type="text/javascript">
  16. GBS_insertEmbeddedViewer("'.$id.'", '.$width.','.$height.');
  17. </script>';
  18. }
  19.  
  20. Post:
  21. [gbooks id="0578022702" width="400" height="400"]
RAW Paste Data