Skip to content

Instantly share code, notes, and snippets.

View afiru's full-sized avatar

アーバンプロジェクトサイト課 afiru

View GitHub Profile
@afiru
afiru / WordBench サンプルコード(テスト時)
Created January 6, 2017 05:19
WordBenchで使用するコード
add_action('after_setup_theme', function () {
add_theme_support('starter-content', [
// 今回はフロントページとしてhomeという固定ページを使用して、ブログのフィードを設置する。
'options' => [
'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}',
],
// 固定ページの設定「home(トップページ)」「about(コンセプト)」「contact(お問い合わせ)」「blog(ブログ)」
'posts' => [
'home', 'about', 'contact', 'blog'
],
@afiru
afiru / WordBench サンプルコード(固定ページ作成)
Created January 6, 2017 05:24
WordBenchのスライドで使うコード
'posts' => array(
'スラッグ名' => array(
'post_type' => 'page',
'post_title' => '固定ページのタイトルについて',
'post_content' => 'こちらに本文を入れることができます。',
'post_excerpt' => 'こちらに抜粋部分の指定ができます。,
'file' => 'こちらに使用する画像の設定などができます。例:(images/yukina_birthday.jpg)',
'thumbnail' => 'サムネイルの設定ができます。例:(images/yukina_birthday.jpg)',
),
),
@afiru
afiru / WordBench サンプルコード(記事)
Created January 6, 2017 05:26
WordBenchで使用するサンプルコード 記事ページ
'posts' => array(
'samplepage' => array(
'post_type' => post,
'post_title' => '固定ページのタイトルについて',
'post_content' => 'こちらに本文を入れることができます。',
'post_excerpt' => 'こちらに抜粋部分の指定ができます。',
'file' => 'こちらに使用する画像の設定などができます。',
'thumbnail' => 'サムネイルの設定ができます。',
),
),
@afiru
afiru / WordBench サンプルコード(メニュー)
Last active January 6, 2017 09:00
WordBenchで使用するコード
'nav_menus' => array(
'top_nav' => array(
'name' => __('ナビのメニュー名', 'id'),
'items' => array(
'home_link' =>array(
'title'=> 'トップ',
'url' => home_url(),
),
'page_link_01' => array(
'title'=> 'メニュー1',
@afiru
afiru / WordBench サンプルコード(ウィジット)
Created January 6, 2017 09:05
WordBenchで使用するコード
'widgets' => array(
'サイドバー名' => array(
'text_business_info',//項目
'search',
'text_about',
),
),
'attachments' => array(
'画像スラッグ' => array(
'post_title' => '画像名',
'post_content' => '画像本文',
'post_excerpt' => '画像抜粋',
'file' => '(テーマディレクトリ)/images(フォルダ)/featured-logo.jpg',
),
),
//画像ファイルを設定していると下記のように{{}}で指定が出来ます
'posts' => array(
----------------------------------------------------
■使用方法
----------------------------------------------------
投稿内で使用する場合
[news_picup postnum=20 posttype=post categoryslug=カテゴリースラッグ]
テンプレート内で使用する場合
news_post_in_template(10,'post','php');
と記載
----------------------------------------------------
■使用方法
----------------------------------------------------
投稿内で使用する場合
[category_down_menu limit=階層の数(親子孫などの数) parcatid=親となるカテゴリーID categoryslug=0]
テンプレート内で使用する場合
allcatlist('階層の数(親子孫などの数)', '親となるカテゴリーID');
と記載
<section class="calender">
<?php
$get_date = filter_input( INPUT_GET, "date" );
if(empty($get_date)){
$year = date('Y');
$month = date('n');
$now_month =date('m');
}else {
$year = date('Y',strtotime($get_date));
add_action('after_setup_theme', function () {
add_theme_support('starter-content', [
// 今回はフロントページとしてhomeという固定ページを使用して、ブログのフィードを設置する。
'options' => [
'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}',
],
// 固定ページの設定「home(トップページ)」「about(コンセプト)」「contact(お問い合わせ)」「blog(ブログ)」
'posts' => [
'home', 'about', 'contact', 'blog'
],