Uyarı! Bu yazı 20.05.2016 tarihinde yazıldı. O günden bu güne bir çok şey değişmiş ve yazı geçerliliğini yitirmiş olabilir.
WordPress uygulama olarakta ve kullanım olarakta her zaman tercih edilen yayın sistemidir. Peki sitemiz için kendimize göre bir tema yapabilir miyiz? Çok zor mudur? Aslında wordpress kullanan her blogcu wordpress kodları ile aşır neşir olduğu için kodları ezberlemiş olması gerekir. Tabi yeni başlayanlar ve tema yapımını bilmeyenlerin de faydalanacağı bir liste oluşturmak gerekiyor. Wordpress'te her kod kısa olduğu kadar kullanım olarakta kolaydır.
Header.php Kodları
Header.php'yi Çağırır<?php get_header(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=windows-1254" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title><?php bloginfo('name'); ?> <?php bloginfo('description'); ?> <?php if ( is_single() ) { ?> <?php } ?> <?php wp_title(); ?></title> <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats --> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" /> <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> <?php wp_head(); ?> </head>
<?php bloginfo('name'); ?>
<?php bloginfo('description'); ?>
<?php bloginfo('version'); ?>
<?php bloginfo('stylesheet_url'); ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php bloginfo('atom_url'); ?>
<?php bloginfo('rss2_url'); ?>
<?php bloginfo('charset'); ?>
Yazı Kodları
Yazı Başlığı<?php the_title(); ?>
<?php the_permalink() ?>
<?php the_content(''); ?>
<?php comments_popup_link(__('Yorum yapılmamış'), __('1 yorum yapılmış'), __('% yorum yapılmış'), '', __('Yorumlara kapalı')); ?>
<?php if(function_exists('the_views')) { the_views(); } ?>
<?php get_calendar(); ?>
<?php the_time('m-d-y') ?>
<?php the_author(); ?>
<?php the_ID(); ?>
<?php edit_post_link(); ?>
<?php next_post_link(' %link ') ?>
<?php previous_post_link('%link') ?>
<?php posts_nav_link(); ?>
<?php the_category(', ') ?>
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php the_author_description(''); ?>
<?php the_author_posts('');?>
<?php the_author_link('');?>
<?php the_author_url(''); ?>
Genel Kodlar
Sidebar.php'yi Çağırır<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php comments_template(); ?>
<?php wp_list_pages('title_li=<h2>Son Sayfalar</h2>'); ?>
<?php wp_tag_cloud('smallest=8&largest=20'); ?>
<?php wp_list_cats(); ?>
<?php get_links_list(); ?>
<?php wp_list_pages('title_li='); ?>
<?php get_calendar(''); ?>
<?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; ?>
<?php if ( has_post_thumbnail() ) {the_post_thumbnail();} else {}?>
add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 125, 125 );
<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>
<?php $canerozgurel = get_posts('numberposts=5&category=26'); foreach ($canerozgurel as $post) : setup_postdata($post); ?> <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a><h2> <?php the_content(); ?> <?php endforeach; ?>
<?php if ( is_day() ) : printf( __( 'Günlük Arşiv: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' ); elseif ( is_month() ) : printf( __( 'Aylık Arşiv: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' ); elseif ( is_year() ) : printf( __( 'Yıllık Arşiv: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' ); else : _e( 'Archives', 'twentytwelve' ); endif; ?>
<?php wp_get_archives('type=monthly'); ?>
<?php query_posts('orderby=rand&posts_per_page=10' ); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php endwhile; endif; wp_reset_query(); ?>
Style.css İçeriği
/* Theme Name: Caner Dio Teması Theme URI: https://www.bycaner.com/ Description: Caner Dio Teması Version: 1.0 Author: Caner Özgürel Author URI: https://www.bycaner.com/ */
Etiketler
Sağol