Merhaba Arkaşlar bir kaç gündür yazı yazmıyorum.Bu Yazımda WordPress`de eklentisiz son yazıları listeletmeyi anlatıcağım.Oldukça basit bir işlem aşağıdaki kodları inceliyebilirsiniz.
Başlayalım
1) İlk olarak functions.php kodlarını yazalım.<?php kodunu bulalım ve altına aşağıdaki kodları ekleyelim.
add_theme_support( 'post-thumbnails'); set_post_thumbnail_size( 640,250,true); add_image_size('single-post-thumbnail', 640,250 ); /* POPULER YAZILAR */ function wpb_set_post_views($postID) { $count_key = 'wpb_post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); /* #POPULER YAZILAR */
2) Şimdide Son yazıları nerede göstermek istiyorsanız oraya aşağıdaki kodları girin.Görüntülenecek yazı sayısını showpost=15 olan kısımdan değişebilirsiniz.
<?php if(function_exists('rps_show')) echorps_show(); ?> <?php query_posts('showposts=15'); ?> <?php while (have_posts()) : the_post(); ?> <ul> <li> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php if(has_post_thumbnail()) { the_post_thumbnail(); } elseif( $thumbnail = get_post_meta($post->ID, 'resim', true) ){ ?> <img src ="<?php echo $thumbnail; ?>" alt="<?php the_title(); ?>" title = "<?php the_title(); ?>" /> <?php } ?> </a> <h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4> </li> </ul> <?php endwhile;?>