WordPress Temel Tema Kodları Kullanımı
1- Tema Url Adresi Kodu
2- Site Url Adresi Kodu
3- Header.php Sayfa çağırıp gösterme kodu
4- Sidebar.php Sayfa çağırıp gösterme kodu
5- Footer.php Sayfa çağırıp gösterme kodu
6- Herhangi bir sayfayı çağırma kodu
7- Belirlediğimiz sayıda içerik Listeleme Kodu. Not: Bu kod ile sayfalama çalışmaz.
8- İçerik link kodunu göstermek (a href kodu)
9- İçerik başlığı title kodu
10- Wp-post views eklentisi izleme sayısı gösterme kodu
11- İçerik kategori ismini gösterme kodu
12- Etiket Bulutu Kodu
13- Özel alan çağırıp gösterme kodu
14- Belirli sayıda kelimede içerik yazısı gösterme kodu
15- Belirli sayıda içerikleri listeleme kodu Not: Sayfalamalarda da çalışır kullanabilirsiniz.
16- Sayfalama eklentisi wp-pagenavi dahilinde, içerik sayısının admin paneli okuma kısmında Ayarlar> Okunma ayarlandığı içerik listeleme kodudur.
17- single.php ve page.php içine içerik yani eklediğimiz yazının tamamını göstermek için kodu
18- single.php içerik yazısını (content) gösterme kodu
19- Yorum için comments.php Yorum şablonunu gösterme kodu
20- Kategorileri veya alt kategorileri listeler
21- Yorum gösterme kodudur.
22- İstemediğimiz kategoriyi kategoriyi gizlemek için kullandığımız içerik listeleme kodudur. (cat=-7 dikkat ediniz, Bu kategori yazıları gösterilmeyecektir.)
23- Part sistemi için içerik içinde bölümlendirme kodu nextpage kodunu içeriğe yazarak bölümlere ayrılır.
24- İçerik Tarihini gösterme kodu
25- İçerik Yazarının Adını Kodu
26- Kategori İsmini Gösterme Kodu
27- İlgili içerik sayfa gösterildiğinde o içerikten önceki ve sonraki yazı linkini verir.
28- Sitedeki Toplam İçerik Sayısını Gösterme Kodu
29- Pagenavi eklentisi sayfalama kısmını gösterme kodu.
30- header.php için standart title başlık kodu.
31- İlgili yazı veya sayfanın toplam yorum sayısını gösterir.
1- Tema Url Adresi Kodu
Kod:
<?php bloginfo('template_url'); ?>
Kod:
<?php bloginfo('siteurl');?>
Kod:
<?php get_header(); ?>
4- Sidebar.php Sayfa çağırıp gösterme kodu
Kod:
<?php get_sidebar(); ?>
Kod:
<?php get_footer(); ?>
Kod:
<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
Kod:
<?php query_posts('showposts=8&cat=1');?>
<?php while (have_posts()) : the_post(); ?>
Çağıralacak kod
<?php endwhile; ?>
Kod:
<?php the_permalink() ?>
Kod:
<?php the_title(); ?>
Kod:
<?php if(function_exists('the_views')) { the_views(); } ?>
Kod:
<?php the_category(', '); ?>
Kod:
<?php the_tags(' ', ', ', ''); ?>
Kod:
<?php if( get_post_meta($post->ID, "resim", true) ): ?>
<?php echo get_post_meta($post->ID, "resim", true); ?>
<?php else: ?>
<?php endif; ?>
Kod:
<?php the_content_rss('', TRUE, '', 10); ?>
Kod:
<?php
$my_query = new WP_Query('orderby=rand&showposts=15');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>
Kullanılacak kodunuz:
<?php endwhile; ?>
Kod:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Kullanılacak kod:
<?php endwhile; ?>
<div class='sayfalama'><?php wp_pagenavi() ?></div>
<?php else : ?>
<div class="alignleft"><?php next_posts_link(__('« Older Entries')) ?></div>
<div class="alignright"><?php previous_posts_link(__('Newer Entries »')) ?></div>
<div class="clear"></div>
<?php endif; ?>
Kod:
<?php
if (have_posts()) : while (have_posts()) : the_post();
$do_not_duplicate = $post->ID;
?>
içerik kodu <?php the_content(''); ?>
<?php endwhile; else : endif; ?>
Kod:
<?php the_content(''); ?>
Kod:
<?php comments_template(); ?>
Kod:
<li <?php if(is_home()) { echo ' class="current-cat" '; } ?>><a href="<?php bloginfo('url'); ?>">Anasayfa</a></li>
<?php wp_list_categories('depth=3&child_of=1&hide_empty=0&orderby=name&show_count=0&use_desc_for_title=1&title_li='); ?>
Kod:
<?php
$wp_query = new WP_Query();
$wp_query->query('showposts=5&cat=-416&paged='.$paged);
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
içerik gelicek
<?php endwhile; ?>
Kod:
<?php
$wp_query = new WP_Query();
$wp_query->query('showposts=5&cat=-416&paged='.$paged);
?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
içerik gelicek
<?php endwhile; ?>
Kod:
<?php wp_link_pages('before=<p>&after=</p>&pagelink=%.Bölüm'); ?>
Kod:
<?php the_time('l, F jS, Y') ?>
Kod:
<?php the_author(','); ?>0
Kod:
<?php the_category(', '); ?>
Kod:
<?php previous_post_link('%link') ?> Önceki İçerik Linki
<?php next_post_link('%link') ?> Sonraki İçerik Linki
Kod:
<?php
$args=array(
‘orderby’ => ‘name’,
‘order’ => ‘ASC’
);
$categories=get_categories($args);
$cat_count = 0;
foreach($categories as $c) {
$cat_count++;
}
$count_posts = wp_count_posts();
$published = $count_posts->publish;
?>
Toplam içerik sayısı :<?php echo $published;?>
Kod:
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
Kod:
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
Kod:
<?php comments_number('0 Yorum','1 Yorum','% Yorum'); ?>