カスタムフィールドでニットカフェ情報設置参考

カスタムフィールドでニットカフェ情報設置参考

スポンサーリンク

カスタムフィールドテンプレートオプション

[title]
type = text
size = 100
label =<br />◆ ワークショップ名を全角13文字以内で記入<br />(一覧ページでサムネイル画像と共に表示されます)<br /><br />
[catchtitle]
type = text
size = 26
label =<br />◆ キャッチコピーなどを記入<br /><br />
[lecturer]
type = text
size = 50
label = <br />◆講師名が決まっていたら記入(個人名じゃなくてもOK)<br /><br />
[honbun]
type = textarea
tinyMCE = true
htmlEditor = true
rows = 20
cols = 80
output = true
label = <br />◆内容を記入<br /><br />
[price]
type = text
size = 50
label = <br />◆費用目安<br />例:2000~6000円くらい<br /><br />
[day]
type = text
size = 26
label =<br />◆ 開催日<br />例1: 毎週水曜日(数字は半角で、全角13文字以内)例2:不定期 <br /><br />
[town]
type = select
value = 北海道#青森県#岩手県#宮城県#秋田県#山形県#福島県#茨城県#栃木県#群馬県#埼玉県#千葉県#東京都#神奈川県#新潟県#富山県#石川県#福井県#山梨県#長野県#岐阜県#静岡県#愛知県#三重県#滋賀県#京都府#大阪府#兵庫県#奈良県#和歌山県#鳥取県#島根県#岡山県#広島県#山口県#徳島県#香川県#愛媛県#高知県#福岡県#佐賀県#長崎県#熊本県#大分県#宮崎県#鹿児島県#沖縄県
label =<br />◆ 都道府県を選択!(検索用)<br /><br />
[addres]
type = text
size = 50
label =<br /> ◆開催会場住所<br />例:東京都XX区XX町1‐2‐3 (半角数字)<br /><br />
[hall]
type = text
size = 100
label =<br />◆ 開催会場の名称<br />例: XXマンション5F , XXタワー , XX会館 など・・・<br /><br />
output = true
[acces]
type = textarea
tinyMCE = true
htmlEditor = true
rows = 20
cols = 80
output = true
label = <br />◆駅、路線,徒歩○分、などアクセスを記入<br /><br />
[tel]
type = text
size = 50
label = <br />◆電話番号(半角数字、ハイフンなし)  例: 09023456789</br><br />
[mail1]
type = text
size = 50
label =<br />◆連絡先メールアドレス<br />@(アットマーク)の前と後ろと分けて記入して下さい。<br />@部分は★マークで表示されるようになっています。(迷惑メール対策のため)<br /><br />@(アットマーク)の前を記入<br />例 mihon@exsample.com  ならば “mihon” </br><br />
[mail2]
type = text
size = 50
label =<br />@(アットマーク)の後ろを記入<br />例 mihon@exsample.com  ならば “exsample.com” </br><br />
[sitelink]
type = text
size = 50
label =<br />◆ 主催者サイト<br />例:  http://exsample.com/  </br><br />
[kiiwaado]
type = text
size = 100
label = ①メタタグ・キーワード<br />
[sab1]
type = file
mediaButton = true
mediaLibrary = true
output = true
label = <br />◆メイン画像(ページ1枚目)◆<br />このページ一番右にある【アイキャッチ画像】から登録してください。一覧でのサムネイル画像になるので必ず入れて下さい。<br />登録方法がわからない場合はこちらをご覧ください。<br /> http://rouranca.com/manual/<br /><br />◆サブ画像(ページ2枚目)<br /><br />
[sab2]
type = file
mediaButton = true
mediaLibrary = true
output = true
label = <br />◆サブ画像(ページ3枚目)<br /><br />

 [cft] and [cftsearch] Shortcode Format用

<?php
//altとtitleを変更する
$args = array(
'alt' => wp_kses($post->post_title, array()),
'title' => false,
);
//サイズの定義
$size = array(425, 425);
//画像をHTMLで取得する
$postImg = wp_get_attachment_image(post_custom('sab1'), $size, false, $args);
 
if($postImg) { ?>
<figure class="postImg"><?php echo $postImg; ?></figure>
<p><?php echo $postImgSrc[0]; ?></p>
<?php } ?>
 
<?php
//altとtitleを変更する
$args = array(
'alt' => wp_kses($post->post_title, array()),
'title' => false,
);
//サイズの定義
$size = array(425, 425);
//画像をHTMLで取得する
$postImg = wp_get_attachment_image(post_custom('sab2'), $size, false, $args);
 
if($postImg) { ?>
<figure class="postImg"><?php echo $postImg; ?></figure>
<p><?php echo $postImgSrc[0]; ?></p>
<?php } ?>
<br />
<p><strong><span style="font-size: medium; color: #fa22ac;">編み物ワークショップ</span></strong></p>
<table id="color"  border="0" width="580" cellspacing="0" cellpadding="8">
<tr>
<td width="120"  align="center">ワークショップ名</td>
<td align="left" colspan="2">[title]</td>
</tr>
<tr>
<td width="120"  align="center">説明</td>
<td align="left" colspan="2">[catchtitle]</td>
</tr>
<tr>
<td width="120"  align="center">講師</td>
<td align="left" colspan="2">[lecturer]</td>
</tr>
<tr>
<td width="120"  align="center">内容</td>
<td align="left" colspan="2">[honbun]</td>
</tr>
<tr>
<td width="120"  align="center">日時</td>
<td align="left" colspan="2">[day]</td>
</tr>
<tr>
<td width="120"  align="center">費用目安</td>
<td align="left" colspan="2">[price]</td>
</tr>
<tr>
<td rowspan="2" width="120"  align="center">場所</td>
<td colspan="2" align="left" >[addres]</td>
</tr>
<tr>
<td colspan="2" align="left">[hall]</td>
</tr>
<tr>
<td width="120"  align="center">アクセス</td>
<td align="left" colspan="2">[acces]</td>
</tr>
<tr>
<td width="120" align="center">電話</td>
<td colspan="2" align="left" ><a href="tel:[tel]">[tel]</a></td>
</tr>
<tr>
<td width="120" align="center">メール</td>
<td colspan="2" align="left" ><a href="mailto:[mail1]@[mail2]">[mail1]★[mail2]</a><br/>★を@に変更してね!</td>
</tr>
<tr>
<td width="120" align="center">情報元サイト</td>
<td colspan="2" align="left" ><a href="[sitelink]">[sitelink]</a> </td>
</tr>
</table>
<div id="hiduke">こちらの情報は <?php the_time('Y年m月d日 (D)'); ?>時点での情報です <?php edit_post_link(__('Edit This')); ?></div><br />

テンプレートファイルの表示させたい場所に記入

 header.php

<meta name="keywords" content="<?php $key="kiiwaado"; echo get_post_meta($post->ID, $key, true); ?>, 共通キーワード,共通キーワード">

single.php

上記で作成したformatを★とする。

<?php

echo do_shortcode('[cft format="★" post_id="'.get_the_ID().'"]');
?>

【おおよその会場地図】<br />
正確でない場合がございます。行かれる際は情報元サイトと地図サイトで再確認下さい。
<!-- マップを記述 -->
<div id="googlemapapi">
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.jp/maps?q=<?php echo get_post_meta($post->ID,'addres',true); ?>&output=embed&iwloc=B"></iframe></div>
<!-- マップおわり -->