Advertisement
pusatdata

WP Trik: Menambahkan Thumbnail di WP-Theme

Apr 23rd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. 1. function.php:
  2. add_theme_support( 'post-thumbnails' );
  3. set_post_thumbnail_size( 100, 100, true );
  4.  
  5. =====================
  6.  
  7. 2. index.php, tag.php, category.php.
  8. Letakkan sebelum <?php the_excerpt(''); ?> atau <?php the_content(''); ?>, boleh juga sebelum title
  9. <?php if ( has_post_thumbnail() ) {
  10. the_post_thumbnail();
  11. } else {
  12. echo '<img src="http://i1147.photobucket.com/albums/o553/jonobones/thumbnaildefault.png" alt="'.get_the_title().'" class="wp-post-image"/>';
  13. } ?>
  14.  
  15. ====================
  16.  
  17. 3. style.css
  18. img.wp-post-image {
  19. float:left;
  20. margin-right:5px;
  21. width:100px;
  22. height:100px;
  23. padding:3px;
  24. border:solid 1px #cccccc; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement