Merhabalar, Turk Hack Team ailesi WordPress çoğumuzun kullandığı hazır ve ücretsiz bir çok amaçlı yazılımdır. Bu kodları sizlerle paylaşma gereği duydum ve paylaşıyorum.
WordPress Versiyonunu Çekmek
Kod:
<?php bloginfo('version'); ?>
WordPress Atom Adreslerini Çekmek
Kod:
<?php bloginfo('atom_url'); ?>
WordPress RSS Adresi Çekmek
Kod:
<?php bloginfo('rss2_url'); ?>
WordPress Karakter Kodlaması Çekmek
Kod:
<?php bloginfo('charset'); ?>
WordPress Blog Adı Çekmek
Kod:
<?php bloginfo('name'); ?>
WordPress Blog Açıklaması Çekmek
Kod:
<?php bloginfo('description'); ?>
WordPress Blog URL Çekmek
Kod:
<?php bloginfo('url'); ?>
WordPress Still Dosyası Çekmek
Kod:
<?php bloginfo('stylesheet_url'); ?>
WordPress Tema Yolu Çekmek
Kod:
<?php bloginfo('template_url'); ?>
WordPress Header.php Çağırmak
Kod:
<?php get_header(''); ?>
WordPress Sidebar.php Çağırmak
Kod:
<?php get_sidebar(''); ?>
WordPress Footer.php Çağırmak
Kod:
<?php get_footer(''); ?>
WordPress Kategorileri Listelemek
Kod:
<?php wp_list_cats('title_li='); ?>
WordPress Sayfaları Listelemek
Kod:
<?php wp_list_pages('title_li='); ?>
WordPress Takvimi Çağırmak
Kod:
<?php get_calendar(''); ?>
WordPress Arşivleri Listelemek
Kod:
<?php wp_get_archives('') ?>
WordPress Son Yorumları Listelemek
Kod:
<?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;
?>
WordPress Konu Çekme Döngüsü
Kod:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>Çekilecek Veriler<?php endwhile;else : ?>
WordPress Yazı Başlığını Çekmek
Kod:
<?php the_title(''); ?>
WordPress Yazı URL Çekmek
Kod:
<?php the_permalink('') ?>
WordPress Yazı Kategorisi Çekmek
Kod:
<?php the_category(', ') ?>
WordPress Yazı Tarihi Çekmek
Kod:
<?php the_time('j F Y'); ?>
WordPress Yazı İçeriği Çekmek
Kod:
<?php the_content(''); ?>
WordPress Yazının Yayınladığı Saati Çekmek
Kod:
<?php the_time('H:i:s'); ?>
WordPress Yazının Yapılan Yorumların Sayfası
Kod:
<?php comments_popup_link(__('Yorum yapılmamış,ilk yorumu senyap :)'), __('1 yorum yapılmış'), __('% yorum yapılmış')
WordPress Sayfalama Yapmak (WP-Postviews ile )
Kod:
<?php if(function_exists('the_views')) { the_views(); } ?>
WordPress Yazı ID'si Çekmek
Kod:
<?php if(function_exists('the_views')) { the_views(); } ?>
WordPress Yazı Düzenleme Linki (Sadece Adminlerde Çalışır)
Kod:
<?php edit_post_link(); ?>
WordPress Yorum Şablonu Çekme
Kod:
<?php comments_template(); ?>
WordPress Yazar Adı Çekme
Kod:
<?php the_author(''); ?>
WordPress Yazar Hakkında Çekme
Kod:
<?php the_author_description(''); ?>
WordPress Yazar İsmi Çekme
Kod:
<?php the_author_description(''); ?>
WordPress Yazar Soy İsmi Çekme
Kod:
<?php the_author_lastname(''); ?>
WordPress Yazarın Sayfası Çekme
Kod:
<?php the_author_link('');?>
WordPress Yazarın Websitesi URL
Kod:
<?php the_author_url(''); ?>
WordPress Yazarın Mail Adresi
Kod:
<?php the_author_email('');?>
WordPress Sonraki Yazı Linki
Kod:
<?php next_post_link('') ?>
WordPress Önceki Yazı Linki
Kod:
<?php previous_post_link('') ?>
WordPress Öne Çıkarılmış Görsel Kullanımı
Kod:
<?php if ( has_post_thumbnail() ) {the_post_thumbnail();} else {}?>
WordPress Arama Formu Kullanımı
Kod:
<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>
WordPress Style Kullanımı (Bu kod olmazsa tema tanımlanamaz)
Kod:
/*
Theme Name: Burası Tema İsmi
Theme URI: tema sitesi
Description: Açıklama
Author: tema yapımcısı
Author URI: yapımcı url
Version: güncel tema versiyonu
*/