WordPress’te Kullandığımız Tema Kodları

WordPress Versiyonunu Gösterme

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

Atom Adresi

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

RSS Adresi

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

Karakter Kodlaması

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

Blog Adı

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

Blog Açıklaması

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

Blog Adresi

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

Stil Dosyası

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

Tema Yolu

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

Header.php Çağırma

<?php get_header(''); ?>

Sidebar.php Çağırma

<?php get_sidebar(''); ?>

Footer.php Çağırma

<?php get_footer(''); ?>

Kategorileri Listeler

<?php wp_list_cats('title_li='); ?>

Sayfaları Listeler

<?php wp_list_pages('title_li='); ?>

Takvimi Gösterme

<?php get_calendar(''); ?>

Arşivleri Listeleme

<?php wp_get_archives('') ?>

Son Yorumları Listeleme

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

Yazı Çekme

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>Çekilecek Veriler<?php endwhile;else : ?>

Yazı Başlığı

<?php the_title(''); ?>

Yazı Adresi

<?php the_permalink('') ?>

Yazı Kategorisi

<?php the_category(', ') ?>

Yazı Tarihi

<?php the_time('j F Y'); ?>

Yazı İçeriği

<?php the_content(''); ?>

Yazının Yayınladığı Saat

<?php the_time('H:i:s'); ?>

Yazıya Yapılan Yorum Sayısı

<?php comments_popup_link(__('Yorum yapılmamış'), __('1 yorum yapılmış'), __('% yorum yapılmış'), '', __('Yorumlara kapalı')); ?>

Yazı ID

<?php the_ID(); ?>

Yazıyı Düzenleme Linki

<?php edit_post_link(); ?>

Yorum Şablonu (Comments.php)

<?php comments_template(); ?>

Yazar Adı

<?php the_author(''); ?>

Yazar Hakkında

<?php the_author_description(''); ?>

Yazar İsmi

<?php the_author_firstname(''); ?>

Yazar Soyismi

<?php the_author_lastname(''); ?>

Yazarın Makale Sayısı

<?php the_author_posts('');?>

Yazar Sayfası

<?php the_author_link('');?>

Yazarın Web Sitesi

<?php the_author_url(''); ?>

Yazarın E-posta Adresi

<?php the_author_email('');?>

Sonraki Yazı Linki

<?php next_post_link('') ?>

Önceki Yazı Linki

<?php previous_post_link('') ?>

Öne Çıkarılmış Görsel Kullanımı

While döngüsü içerisinde ;

<?php if ( has_post_thumbnail() ) {the_post_thumbnail();} else {}?>

funtions.php’de eklenecek ;

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 125, 125 );

The Excerpt kullanımı

While Döngüsü içerisinde ;

<?php the_excerpt(''); ?>

functions.php’de eklenecek ;

function new_excerpt_length($length) {
return 12;
}
add_filter('excerpt_length', 'new_excerpt_length');

Arama Formu

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>">
<input class="searchbg" type="text" name="s" id="s" onfocus="if (this.value == 'Ara ...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Ara ...';}" />
<input class="button" type="button" value="" />
</form>

Yorumlar

Burası çok boş... yorum bırakabilirsin!

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Sidebar