WordPress siteniz için hazır kodlar. Bu kodlar çok işinize yarayacak temanızda bulunmayan widget’leri ekleyebilicek veya hiç eklenti ile uğraşmadan bir çok ayarı yapabiliceksiniz. Bu kodlar daima yardımcınız olucaktır 🙂
Son Yazılar
Başlık biliyorsunuz h2 olarak ayarlıyoruz. Eğer içerik başlığı değilse kesinlikle h2 veya h3 olması gerekiyor. SEO Açısından önemli.
showposts=”5″ yazan kısıma 10 yazdığınızda son 10 yazı listelenir. Kaç yazarsanız o kadarı listelenir. Ancak fazla yazmanızı tavsiye etmem sunucunuzu yorabilirsiniz.
1 2 3 4 5 6 7 8 | <h2>Son Yazılar</h2> <div class = "submenu" > <ul> <?php query_posts( 'showposts=5' ); ?> <?php while (have_posts()) : the_post(); ?> <li><a href= "<?php the_permalink() ?>" rel= "bookmark" title= "<?php _e('Permanent link to'); ?> <?php the_title(); ?>" ><?php the_title(); ?></a> - <?php the_time( 'm-d-Y' ) ?></li> <?php endwhile ;?> </ul> |
Kategorileri listelemek
Alttaki kodu eklediğiniz yerde Kategoriler listelenicektir.
1 2 3 4 5 | <span style= "color: black;" ><h2>Kategoriler</h2> <div> <ul> <?php wp_list_cats( 'sort_column=name&optioncount=1&hierarchical=0' ); ?> </ul></span> |
Sayfaları listelemek
Alttaki iki kod ilede sayfaları listeleyebiliriz.
1 2 3 4 | <span style= "color: black;" ><h2>Sayfalar</h2> <ul> <?php wp_list_pages( 'title_li=' ); ?> </ul></span> |
yada
1 | <span style= "color: black;" > <?php wp_list_pages( 'title_li=' . __( 'Sayfalar:' )); ?></span> |
Son Yorumlar Kodu
Son yorumları listelemek için bu kodu kullanmanız yeterli olucaktır.
1 2 3 4 5 | <span style= "color: black;" ><h2>Son Yorumlar</h2> <?php if (function_exists( 'get_recent_comments' )) { ?> <?php get_recent_comments(); ?> <?php } ?></span> |
Arşivi listelemek için
Alttaki kodu eklediğinizde aylık arşiv listelenicektir.
1 2 3 4 | <span style= "color: black;" ><h2>Arşiv</h2> <ul> <?php wp_get_archives( 'type=monthly&limit=12&show_post_count=1' ); ?> </ul></span> |
Takvim kodu
Alttaki kod takvimi göstericektir. Tema geliştiricileri için güzel hazır kodlar. Değerlendirebiliceğiniz bir sürü kod 🙂
1 2 | <span style= "color: black;" ><h2>Takvim</h2> <?php get_calendar(2); ?> </span> |
Yazı bilgileri
Bu kod yazının en sonuna eklenir. Yazının hangi tarihte yayınlandığı, RSS linki, Yorumlar vs.
1 2 3 | <span style= "color: black;" ><h4>Yazı Bilgileri:</h4> <div> <?php the_time( 'j F Y l' ) ?> günü, <?php the_time() ?> gibi <?php the_category( ', ' ) ?> kategorisinde yayınlanmış, <?php comments_rss_link( 'RSS 2.0' ); ?> ile takip edebilir, <a href= "#respond" >yorum bırakabilir</a> yada <a href= "<?php trackback_url(display); ?>" >geri izleme</a> ile siteniz üzerinden takip edebilirsiniz.</span> |
Arama kodu
Alttaki 2 kodda arama kutusunu çıkarıcaktır. Hangisi size uygun gelirse ancak ilk kodu kullanıcaksanız php_self yerine direkt sitenizide yazabilirsiniz.
1 2 3 4 5 | <span style= "color: black;" ><h2>Aramak istediğiniz kelimeyi girin:</h2> <form id= "searchform" method= "get" action= "<?php echo $_SERVER['PHP_SELF']; ?>" > <input type= "text" name= "s" id= "s" size= "55" /> <input type= "submit" value= "<?php _e('Search'); ?>" /> </form></span> |
veya
1 2 3 4 5 6 7 8 9 | <span style= "color: black;" ><li id= "search" > <label for = "s" ><?php _e( 'Arama Yapın:' ); ?></label> <form id= "searchform" method= "get" action= "<?php bloginfo('home'); ?>" > <div> <input type= "text" name= "s" id= "s" size= "15" /><br /> <input type= "submit" value= "<?php _e('Ara'); ?>" /> </div> </form> </li></span> |
Etiket kodu
Etiketleri listelemek için kullanılan kod. Small kodu etiketlerin ufak görünmesi için ekstradan kullanılmış bir kod isterseniz silebilirsiniz.
1 | <span style= "color: black;" > <small><?php the_tags( '<p>Etiketler: ' , ', ' , '</p>' ); ?></small></span> |
Rastgele etiketler
Hep rastgele yazılar kodu eklerdim artık rastgele etiket kodu 🙂
1 2 | <span style= "color: black;" ><h3>Rastgele Etiketler</h3> <?php wp_tag_cloud( 'smallest=8&largest=22&number=30&orderby=count&order=RAND' ); ?></span> |