• Toplam: 0 Oy - Ortalama: 0
  • 1
  • 2
  • 3
  • 4
  • 5
WordPress Temel Tema Kodları
#1
1-

PHP Kod:
<?php bloginfo('template_url'); ?>

Tema Url Kodu

2-

PHP Kod:
<?php bloginfo('siteurl');?>

Site Url Kodu

3-

PHP Kod:
<?php get_header(); ?>

Header.php Sayfa çağırma kodu

4-

PHP Kod:
<?php get_sidebar(); ?>

Sidebar.php Sayfa çağırma kodu

5-

PHP Kod:
<?php get_footer(); ?>

Footer.php Sayfa çağırma kodu

6-

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

Herhangi bir sayfayı çağırma kodu

7-


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


Çağıralacak kod

PHP Kod:
<?php endwhile; ?>

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


8-

PHP Kod:
<?php the_permalink() ?>

İçerik linki kodu

9-

PHP Kod:
<?php the_title(); ?>

içerik başlığı kodu

10-

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

Wp-post views eklentisi izleme sayısı kodu

11-

PHP Kod:
<?php the_category(', '); ?>

İçerik kategori adı gösterme kodu

12-

PHP Kod:
<?php the_tags(' '', '''); ?>

Etiket Kodu

13


PHP Kod:
<?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 Kod:
<?php the_content_rss(''TRUE''10); ?>

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

15-


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


Çağırılacak kod

PHP Kod:
<?php endwhile; ?>

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

16-

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


Çağırılacak kod

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

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

18-

PHP Kod:
<?php the_content(''); ?>

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

19-

PHP Kod:
<?php comments_template(); ?>

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


20-


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

Kategorileri veya alt kategorileri listeleme kodu.

21-


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

Yorumları gösterme kodu

22-


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

İ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 Kod:
<?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 Kod:
<?php the_time('l, F jS, Y'?>

Tarih gösterme kodu

25-

PHP Kod:
<?php the_author(', '); ?>

Yazar İsmi kodu

26-

PHP Kod:
<?php the_category(', '); ?>

Kategori adı kodu

27-


PHP Kod:
<?php previous_post_link('%link'?>
Önceki Link

PHP Kod:
<?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 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;?>

29-

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

Pagenavi eklentisi sayfalama kodu

30-

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

header.php için title baslık kodu

31-

PHP Kod:
<?php comments_number('0 Yorum','1 Yorum','% Yorum'); ?>
#CrawL'ın imzası
"Herkes aynı fikirde ise hiç kimse yeterince düşünmüyor demektir.."
"Gece Gölgenin Telifine Bak"


WebMaster'in Birisi



  Cevapla
#2
Bilmeyenler için yararlı bir konu olmuş. Bunları kullanan kişi az olur genelde hazır tema kullanıldığı için bu tür kodlara ihtiyaç duyulmuyor, kullananlar için yararlı Gülücük
  Cevapla


Hızlı Menü:

Şu anda bu konuyu okuyanlar: 1 Ziyaretçi

Online Shopping App
Online Shopping - E-Commerce Platform
Online Shopping - E-Commerce Platform
Feinunze Schmuck Jewelery Online Shopping