Advertisement
pusatdata

WP PHP Code: Kode Cover/BackCover Berputar

May 10th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. Referensi: http://archive.makzan.net/web-design-scrapbook/the-css-3d-book-flipping-effect/
  2.  
  3. Instal Plugin AFC = Advanced Field Customs
  4. Buat filed dengan nama cover.
  5.  
  6. WP-PostViews (https://wordpress.org/plugins/wp-postviews/) >> setingnya: everyone
  7.  
  8. Kode di index.php atau post-homepage.php:
  9.  
  10. <?php
  11. $my_cover = get_post_meta( get_the_ID(), 'cover', true);
  12. if( ! empty( $my_cover ) ) {
  13. echo '<div style="float:left;"><div class="box-scene">
  14. <div class="box">
  15. <div class="front face">
  16. <img src="http://books.google.co.id/books/content?id=' . $my_cover . '&printsec=frontcover&img=1&zoom=1&edge=curl" width="128" height="195px" style="float:left;padding-left:4px;" >
  17. </div>
  18. <div class="side face">
  19. <img src="http://books.google.co.id/books/content?id=' . $my_cover . '&printsec=backcover&img=1&zoom=1" width="128" height="195px" style="float:left;padding-left:4px;">
  20. </div>
  21. </div>
  22. </div></div>';
  23. }
  24. ?>
  25.  
  26. Kode lengkap isi full post-homepage.php:
  27.  
  28.  
  29. <?php global $theme; ?>
  30.  
  31.  
  32.  
  33. <span style="width: 146px; height: 320px; float: left; margin-right: 5px; margin-bottom: 5px; overflow: hidden; padding-bottom: 15px;">
  34.  
  35. <div <?php post_class('post clearfix'); ?> id="post-<?php the_ID(); ?>">
  36.  
  37.  
  38.  
  39.  
  40. <?php
  41. $my_cover = get_post_meta( get_the_ID(), 'cover', true);
  42. if( ! empty( $my_cover ) ) {
  43. echo '<div style="float:left;"><div class="box-scene">
  44. <div class="box">
  45. <div class="front face">
  46. <img src="http://books.google.co.id/books/content?id=' . $my_cover . '&printsec=frontcover&img=1&zoom=1&edge=curl" width="128" height="195px" style="float:left;padding-left:4px;" >
  47. </div>
  48. <div class="side face">
  49. <img src="http://books.google.co.id/books/content?id=' . $my_cover . '&printsec=backcover&img=1&zoom=1" width="128" height="195px" style="float:left;padding-left:4px;">
  50. </div>
  51. </div>
  52. </div></div>';
  53. }
  54. ?>
  55.  
  56. <div class="clearfix"> </div>
  57. <p style="text-align:center;line-height: 13px;font-size:12px;">
  58. <b><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'themater' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></b> <br/>
  59. (Hits: <?php the_views(); ?>)<br/>
  60. <b>Oleh:</b><br/> <?php the_field('penulis'); ?><br/>
  61. <b>Penerbit:</b><br/> <?php the_category(', '); ?></p>
  62.  
  63.  
  64.  
  65.  
  66.  
  67. </div><!-- Post ID <?php the_ID(); ?> -->
  68.  
  69. </span>
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. =================================
  77. Kode di CSS style.php:
  78.  
  79.  
  80. .box-scene {
  81. -webkit-perspective: 5300;
  82. width: 128px;
  83. height: 195px;
  84. margin-bottom: 10px;
  85.  
  86. }
  87.  
  88. .box-scene:hover .box {
  89. -webkit-transform: rotateY(-90deg);
  90. }
  91. .box {
  92. position: relative;
  93. width: 128px;
  94. height: 195px;
  95.  
  96.  
  97. -webkit-transform-style: preserve-3d;
  98.  
  99. -webkit-transition: all 0.4s ease-out;
  100. -webkit-transform-origin: 30px 30px -30px;
  101.  
  102. /* float: left; */
  103. margin: 5px 0 5px 0;
  104.  
  105.  
  106. }
  107.  
  108. .face {
  109. position: absolute;
  110. width: 100%;
  111. height: 100%;
  112. -webkit-backface-visibility: visible;
  113. -webkit-transform-origin: 0 0;
  114. }
  115. .front {
  116. -webkit-transform: rotateY(0deg);
  117. z-index: 2;
  118. background: #ffffff;
  119.  
  120. }
  121. .side {
  122. background: #ffffff;
  123. -webkit-transform: rotateY(90deg);
  124. z-index: 1;
  125. left: 128px;
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement