WordPress Tema Kodları

İçeriği listeleme / gösterme.

<?php while (have_posts()) : the_post(); ?>
<?php the_permalink() ?> // Link
<?php the_title(); ?> // Başlık
<?php the_content(); ?> // İçerik
<?php the_excerpt(); ?> // Özet içerik
<?php endwhile;?>

Sayfa sıralamasını koymak

<?php echo paginate_links( $args ); ?>

Paginate_links fonskiyonu ile ilgili daha fazla bilgi için tıklayın pagination links function.

Arama kutusu koyma kodu

<?php get_search_form( $echo ); ?>

Daha fazla bilgi için get search form function

Sidebar yapma kodu
functions.php ye eklenecek olan kod

<?php register_sidebars( 1, array( 'name' => 'Sidebar' ) ); ?>

Gösterilecek olan sayfaya yani sidebar.php ye eklenecek olan kod:

<?php dynamic_sidebar( "Sidebar" ); ?>

Yorum alanı koyma kodu

<?php comments_template(); ?>

En basit halleriyle kullanılan fonksiyonlar bunlar.

Öne çıkarılmış görsel / yazı resmini koymak.
Bu kodu functions.php ye ekleyin

<?php add_theme_support('post-thumbnails'); ?>

Resmin gösterilmesi istenen yere ekleyin

 <?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); if ( has_post_thumbnail() ) { ?><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img class="left" src="<?php echo $image_url[0]; ?>" alt="<?php the_title(); ?>" width="125" height="127" /></a><?php } ?>

Tema bilgileri Bu içeriği style.css dosyasının en üstüne yapıştırın ve düzenleyin.

/*
Theme Name: Tema Adı
Theme URI: İsterseniz tema adresi
Author: Yapan kişi
Author URI: Yapan kişinin adresi
Description: Açıklama
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: Temayı tarif eden kelimeler
Text Domain: tema nicki

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/

Bir cevap yazın