PDA

Orijinalini görmek için tıklayınız : WordPress Tema kodları


Ceren
06-07-2013, 12:05
1-

<?php bloginfo('template_url'); ?>

Tema Url Kodu

2-

<?php bloginfo('siteurl');?>

Site Url Kodu

3-

<?php get_header(); ?>

Header.php Sayfa çağırma kodu

4-

<?php get_sidebar(); ?>

Sidebar.php Sayfa çağırma kodu

5-

<?php get_footer(); ?>

Footer.php Sayfa çağırma kodu

6-

<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>

Herhangi bir sayfayı çağırma kodu

7-

<?php query_posts('showposts=8&cat=1');?>
<?php while (have_posts()) : the_post(); ?>

Çağıralacak kod

<?php endwhile; ?>

Belirlediğimiz sayıda içerik Listeleme Kodu. Not: Bu kod ile sayfalama çalışmaz.


8-

<?php the_permalink() ?>

İçerik linki kodu

9-

<?php the_title(); ?>

içerik başlığı kodu

10-

<?php if(function_exists('the_views')) { the_views(); } ?>

Wp-post views eklentisi izleme sayısı kodu

11-

<?php the_category(', '); ?>

İçerik kategori adı gösterme kodu

12-

<?php the_tags(' ', ', ', ''); ?>

Etiket Kodu

13-

<?php if( get_post_meta($post->ID, "resim", true) ): ?>
<?php echo get_post_meta($post->ID, "resim", true); ?>
<?php else: ?>
<?php endif; ?>

Özel alan gösterim kodu

14-

<?php the_content_rss('', TRUE, '', 10); ?>

Belli kelimede içerik yazısı gösterme kodu

15-

<?php
$my_query = new WP_Query('orderby=rand&showposts=15');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>

Çağırılacak kod

<?php endwhile; ?>

Belirlediğimiz sayıda içerikleri listeleme kodu Not: Sayfalama çalışır kullanabilirsiniz.

16-

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

Çağırılacak kod

<?php endwhile; ?>
<div class='sayfalama'><?php wp_pagenavi() ?></div>
<?php else : ?>
<div class="alignleft"><?php next_posts_link(__('&laquo; Older Entries')) ?></div>
<div class="alignright"><?php previous_posts_link(__('Newer Entries &raquo;')) ?></div>
<div class="clear"></div>
<?php endif; ?>

Sayfalama eklentisi wp-pagenavi dahil, içerik sayısının admin paneli okuma kısmında ayarlandığı içerik listeleme kodu

17 -

<?php
if (have_posts()) : while (have_posts()) : the_post();
$do_not_duplicate = $post->ID;
?>
içerik kodu <?php the_content(''); ?>
<?php endwhile; else : endif; ?>

single.php ve page.php içine içerik yani eklediðimiz yazının tamamını gösterme kodu

18-

<?php the_content(''); ?>

single.php içerik yazısının kodu 17. kodda mevcut.

19-

<?php comments_template(); ?>

Yorum için comments.php çağırma kodu


20-

<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='); ?>

Kategorileri veya alt kategorileri listeleme kodu.

21-

<?php
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,30) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 10";

$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$output .= "\n<ul>";
foreach ($comments as $comment) {
$output .= "\n<li>".strip_tags($comment->comment_author) .":" . "<a href=\"" . get_permalink($comment->ID)."#comment-" . $comment->comment_ID . "\" title=\"on ".$comment->post_title . "\">" . strip_tags($comment->com_excerpt)."</a></li>";
}
$output .= "\n</ul>";
$output .= $post_HTML;
echo $output;
?>

Yorumları gösterme kodu

22-

<?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; ?>

İstemediğimiz kategoriyi kategoriyi göstrmemek için kullandığımız içerik listeleme kodu .(cat=-416 dikkat ediniz, Bu kategori yazıları gözükmeyecek)


23-

<?php wp_link_pages('before=<p>&after=</p>&pagelink=%.Bölüm'); ?>

Part sistemi için içerik içinde bölümlere ayırma kodu nextpage kodunu içeriğe yazarak

24-

<?php the_time('l, F jS, Y') ?>

Tarih gösterme kodu

25-

<?php the_author(', '); ?>

Yazar İsmi kodu

26-

<?php the_category(', '); ?>

Kategori adı kodu

27-


<?php previous_post_link('%link') ?> Önceki Link
<?php next_post_link('%link') ?> Sonraki link

İlgili içerik yerleştirildiğinde o içerikten önceki ve sonraki konuların linkini verir.



28-

<?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;?>


29-

<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

Pagenavi eklentisi sayfalama kodu

30-

<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>

header.php için title baslık kodu

31-

<?php comments_number('0 Yorum','1 Yorum','% Yorum'); ?>

İlgili içeriğin yorum sayısı kodu