Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CARA MEMBUAT FEATURED IMAGE WORDPRESS
- PERTAMA:
- function.php:
- <?php
- add_theme_support( 'post-thumbnails' );
- set_post_thumbnail_size( 100, 100, true );
- ?>
- KEDUA:
- Jika kode artikelnya masih: <?php the_content(); ?>
- ubah menjadi: <?php if (is_single()) { the_content(); } else { the_excerpt(); } ?>
- tujuannya: agar full HTML hanya muncul di halaman single saja. Sedangkan jika ada di home/index.php atau arsip/category.php, semua kode HTML dinonaktifkan dan hanya menampilkan ringkasannya saja.
- KETIGA:
- index.php atau category.php:
- <?php if ( has_post_thumbnail() ) {
- the_post_thumbnail();
- } else {
- echo '<img src="http://i1147.photobucket.com/albums/o553/jonobones/thumbnaildefault.png" alt="'.get_the_title().'" class="wp-post-image"/>';
- } ?>
- Letakkan sebelum kode tersebut sebelum kode artikel <?php if (is_single()) { the_content(); } else { the_excerpt(); } ?>
- KEEMPAT:
- style.css:
- img.wp-post-image {
- float:left;
- margin-right:5px;
- width:100px;
- height:100px;
- padding:3px;
- border:solid 1px #cccccc; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement