Advertisement
pusatdata

Tambah Caption Featured Image WP Flexithemes

May 18th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Buka post-single.php:
  2.  
  3. 1. Cari kode thumbnail:
  4. <?php
  5. if(has_post_thumbnail()) {
  6. the_post_thumbnail(
  7. array($theme->get_option('featured_image_width_single'), $theme->get_option('featured_image_height_single')),
  8. array("class" => $theme->get_option('featured_image_position_single') . " featured_image")
  9. );
  10. }
  11. ?>
  12.  
  13. 2. Ganti dengan kode berikut:
  14. <div class="wp-caption">
  15. <?php the_post_thumbnail(''); ?> <!-- This displays the featured image -->
  16. <?php if ( $caption = get_post( get_post_thumbnail_id() )->post_excerpt ) : ?>
  17. <p class="wp-caption-text"><?php echo $caption; ?></p>
  18. <?php endif; ?><!-- This displays the caption below the featured image -->
  19. </div>
  20.  
  21. 3. Tambahkan kode berikut di CSS:
  22. .wp-caption {
  23. background: #eee;
  24. border: 1px solid #ddd;
  25. text-align: center;
  26. padding: 4px 4px 0 4px;
  27. margin: 10px;
  28. /* optional rounded corners for browsers that support it */
  29. -moz-border-radius: 3px;
  30. -khtml-border-radius: 3px;
  31. -webkit-border-radius: 3px;
  32. border-radius: 3px;
  33. }
  34.  
  35. .wp-caption img {
  36. margin: 0;
  37. padding: 0;
  38. border: 0 none;
  39. }
  40.  
  41. .wp-caption p.wp-caption-text {
  42. font-size: 11px;
  43. line-height: 17px;
  44. padding: 0 4px 5px;
  45. margin: 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement