[WordPress]ざっくりテンプレ

ざっくりテンプレ

index.php

<!DOCTYPE html>
<html lang="ja">
<?php get_header('Meta'); ?>
<body>
<?php get_header('Top'); ?>

<div id="main" class="clearfix">
<?php get_sidebar('L'); ?>

<div id="content">
	<h2>
		<?php
			if( is_single() ){/* 個別記事 */
				the_title();
			}else if( is_page() ){/* 個別ページ */
				the_title();
			}else if( is_category() ){/* カテゴリーアーカイブ */
				echo 'category : ';
				echo get_cat_name( wp_specialchars($cat,1) );
			}else if( is_search() ){/* 検索結果 */
				echo 'search : ' . wp_specialchars($s, 1);
			}else if( is_archive() ){/* アーカイブ */
				echo 'archive : ' . wp_specialchars($m, 1);
			}else{
				echo 'Home';
			}
		?>
	</h2>

<?php if( is_page() ): ?>	

	<?php if(have_posts()):the_post(); ?>
			<?php if( get_post_status()!='private' && get_post_status()!='pending' ): ?>	
				<?php get_template_part("original-page-$page_id"); ?>
			<?php endif; ?>
	<?php endif; ?>

<?php else: ?>

	<?php if(have_posts()):while(have_posts()):the_post(); ?>
		<?php if( get_post_status()!='private' && get_post_status()!='pending' && !is_page() ): ?>	
			<article>
				<div class="article-inner link-dotted word-break">
					<div class="article-header">
						<a href="<?php the_permalink(); ?>">
							<strong><?php the_title(); ?></strong>
						</a>
						<small class="article-time"><?php the_time('Y年n月j日'); ?></small>
					</div>

					<div class="article-text">
						<?php
							the_content();
						?>
					</div>

					<div class="article-footer clearfix">
						<?php get_template_part('footer-article'); ?>
					</div><!--article-footer-->
				</div><!--article-inner-->
			</article>
		<?php endif; ?>
		<?php endwhile;?>
	<?php else: ?>
			<article>
				<div class="article-inner link-dotted word-break">
					<div class="article-header">
						<img class="article-image" src="<?php echo get_template_directory_uri().'/icon/icon-404.png' ?>"/>
						<strong>
							<?php if (!have_posts() ): ?>
								[Not Found]見つかりませんでした。
							<?php endif; ?>
						</strong>
						<small class="article-time"><?php echo date('Y年m月d日'); ?></small>
					</div>
					<div class="article-text">
						[Not Found]見つかりませんでした。
					</div>
					<div class="article-footer clearfix">
						
					</div><!--article-footer-->
				</div><!--article-inner-->
			</article>
	<?php endif; ?>

<?php endif; ?>

</div><!--content-->

<?php get_sidebar('R'); ?>

</div><!--main-->

<?php get_footer(); ?>

</body>
</html>

header-Meta.php

<head>
	<meta charset="UTF-8" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title></title>
	<meta name="author" content="ktyr report" /> 
	<meta name="copyright" content="ktyr report" />
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link href="<?php echo get_stylesheet_directory_uri(); ?>/icon/favicon.ico?t=2" type="image/x-icon" rel="icon" />
	<link href="<?php echo get_stylesheet_directory_uri(); ?>/icon/favicon.ico?t=2" type="image/x-icon" rel="shortcut icon" />
	<link rel="stylesheet" type="text/css" href="<?php echo get_stylesheet_directory_uri(); ?>/common/css/common.css" media="screen" />
	<script type="text/javascript" src="<?php echo get_stylesheet_directory_uri().'/common/js/jquery-2.0.3.min.js'; ?>"></script>
</head>

header-Top.php

<header>
	<div class="header-inner">
		<div class="header-inner-inner">
			<h1 id="blog-name"><a href="<?=home_url()?>">wp template</a></h1>
		</div>
	</div>
</header>

sidebar-L.php

<div id="sidebarL">
	<section class="relative">
		<form class="mb-14" role="search" method="get" id="searchform" action="<?=home_url()?>" >
			<input type="search" class="" id="s" name="s" placeholder="Search">
			<span class="search-icon">
				<button type="submit">
					<span class="hidden">検索</span>
				</button>
			</span>
		</form>
	</section>
	<section>
		<select class="w-sidebarL" name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> 
			<option value="">archives</option> 
			<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?>
		</select>
	</section>
</div>

sidebar-R.php

<div id="sidebarR">
	<div class="roundbox">
	</div>
</div>

footer.php

<footer>
	<div class="footer-inner">powered by <a href="http://wordpress.org/" target="_blank">WordPress</a></div>
</footer>

footer-article.php

<input type="text" value="<?php the_permalink(); ?>" readonly>

original-page-2.php

オリジナルページ2