何かと簡単な応募サイト  2016年11月21日

News -various

何かと簡単な応募サイト

環境用意
・Single Post Template
・Custom Field Template

ソース例
カスタムフィールドテンプレート

[koumoku]
type = text
size = 35
label = プレゼントタイトル

[naiyou1]
type = text
size = 100
label = 内容1

[naiyou2]
type = text
size = 100
label = 内容2

[bcdh-y]
type = select
value = # 2016年 # 2017年 
default = 2016年
label = 締切年

[bcdh-m]
type = select
value = # 1月 # 2月 # 3月 # 4月 # 5月 # 6月 #7月 # 8月 # 9月 # 10月 # 11月 # 12月 # 
default = 1月
label = 締切月
clearButton = true

[bcdh-d]
type = select
value = # 1日 # 2日 # 3日 # 4日 # 5日 # 6日 #7日 # 8日 # 9日 # 10日 # 11日 # 12日 #  13日 # 14日 # 15日 # 16日 # 17日 # 18日 # 19日 # 20日 # 21日 # 22日 # 23日 # 24日 # 25日 # 26日 # 27日 # 28日 # 29日 # 30日 # 31日 
default = 1日
label = 締切日
clearButton = true

[bcdh-time]
type = select
value = # 日中 # 23:59 # 18:00
default = 日中
label = 締切時間
clearButton = true

[ouboshikaki]
type = text
size = 100
label = 応募資格

[oubohouhou]
type = text
size = 100
label = 応募方法

[oubohouhou-hagaki]
type = text
size = 100
label = 応募方法(ハガキの場合)

[chuuijikou1]
type = text
size = 100
label = 注意事項1

[chuuijikou2]
type = text
size = 100
label = 注意事項2

[chuuijikou3]
type = text
size = 100
label = 注意事項3

[otoiawase]
type = text
size = 100
label = お問い合わせ先





custom01

固定ページテンプレート 例

<?php
/*
Template Name: プレゼント応募カスタム
*/
?>




<?php
/**
 * The template for displaying all pages.
 *
 * This is the template that displays all pages by default.
 *
 * @package ThinkUpThemes
 */

get_header(); ?>

			<?php while ( have_posts() ) : the_post(); ?>
<?php the_post_thumbnail(); ?>
<table class="type02">
<?php if ( get_post_meta($post->ID,'koumoku',TRUE) ): ?>
	<tr>
		<th scope="row">【プレゼントタイトル】</th>
		<td><?php echo post_custom("koumoku")?></td>
	</tr>
<?php endif;?>
<?php if ( get_post_meta($post->ID,'naiyou1',TRUE) ): ?>
	<tr>
		<th scope="row">【内容】</th>
		<td><?php echo post_custom("naiyou1")?></td>
</tr>
<?php endif;?> 
	<tr>
		<th scope="row">【応募締切】</th>
		<td><?php echo post_custom("bcdh-y")?><?php echo post_custom("bcdh-m")?><?php echo post_custom("bcdh-d")?><?php echo post_custom("bcdh-time")?></td>
	</tr>
<?php if ( get_post_meta($post->ID,'ouboshikaki',TRUE) ): ?>
	<tr>
		<th scope="row">【応募資格】</a></th>
		<td><?php echo post_custom("ouboshikaki")?></td>
	</tr>
<?php endif;?> 
<?php if ( get_post_meta($post->ID,'oubohouhou',TRUE) ): ?>
	<tr>
		<th scope="row">【応募方法】</a></th>
		<td><?php echo post_custom("oubohouhou")?></td>
	</tr>
<?php endif;?> 
<?php if ( get_post_meta($post->ID,'oubohouhou-hagaki',TRUE) ): ?>
	<tr>
		<th scope="row">【応募方法(ハガキの場合)】</a></th>
		<td><?php echo post_custom("oubohouhou-hagaki")?></td>
	</tr>
<?php endif;?>
<?php if ( get_post_meta($post->ID,'chuuijikou1',TRUE) ): ?>
	<tr>
		<th scope="row">【注意事項】</a></th>
		<td><?php echo post_custom("chuuijikou1")?></td>
</tr>
<?php endif;?>
<?php if ( get_post_meta($post->ID,'otoiawase',TRUE) ): ?>
	<tr>
		<th scope="row">【お問い合わせ先】</th>
		<td><?php echo post_custom("otoiawase")?></td>
	</tr>
<?php endif;?> 
</table>     
 
				<?php get_template_part( 'content', 'page' ); ?>

				<?php thinkup_input_allowcomments(); ?>

			<?php endwhile; ?>

<?php get_footer(); ?>



custom02

スタイルシート例

/* ---------------------------------------------------------------------------------------
	13. nakaguchi
--------------------------------------------------------------------------------------- */

table.type02 {
	border-collapse: separate;
	border-spacing: 0;
	text-align: left;
	line-height: 1.5;
	border-top: 1px solid #ccc;
	border-left: 1px solid #ccc;
}
table.type02 th {
	width: 200px;
	padding: 10px;
	font-weight: bold;
	vertical-align: top;
	border-right: 1px solid #ccc;
	border-bottom: 1px solid #ccc;
	border-top: 1px solid #fff;
	border-left: 1px solid #fff;
	background: #eee;
}
table.type02 td {
	width: 350px;
	padding: 10px;
	vertical-align: top;
	border-right: 1px solid #ccc;
	border-bottom: 1px solid #ccc;
}
thumcenter {
 display: block;
 margin-left: auto;
 margin-right: auto;
}
imagecenter {
max-width: 50%;
background-color: #eee8aa;
margin: 0 auto;
}
mr50 {
 display: block;
 margin-left: auto;
 margin-right: 50px;
}

custom03

実際は出力していないフィールドの整理をしていないので、ちょっと残作業がある。

固定ページの内容はフォーム。
ジェットパックで簡単に書いてあるのだけれど、ここはちゃんとした方がいいかも???

<img src="応募のボタン" alt="応募のボタン" width="726" height="60" class="aligncenter size-full wp-image-29" />

≪個人情報の取扱いについて≫例 ご記載いただいた個人情報は当社が個人情報保護のために「個人情報保護方針」「個人情報保護に関する宣言」に基づき管理・保護を行います。 この情報は抽選及びプレゼント発送のためのみに利用いたします。
LINE