&tag(WordPress/テーマ);
*目次 [#v6573841]
#contents
*関連ページ [#vb68db9c]
*参考情報 [#cfe3749f]
-[[「脱」初心者の為のブログのSEO:http://stinger3.com/seo/writting/]]
-[[WordPress › Support » Why is h1 not used in most themes?:http://wordpress.org/support/topic/why-is-h1-not-used-in-most-themes]]

*子テーマ [#z15271ee]
-[[子テーマ - WordPress Codex 日本語版:http://wpdocs.sourceforge.jp/%E5%AD%90%E3%83%86%E3%83%BC%E3%83%9E]]より。子テーマとは既存のテーマを変更するもの。ディレクトリと2つのファイル(style.css、functions.php)が必要(といいつつfunctions.phpがなくても動作する)。
-style.cssのスタイルシートヘッダで親テーマを指定する。(Template)。

**子テーマの作成 [#g2069097]
-最低限一つのディレクトリと2つのファイル(style.cssとfunctions.php)から成り立つ。
-フォルダの作成末尾-childが望ましい。
-style.cssを作成。Template行で親テーマのディレクトリ名を指す。
#pre{{
/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fifteen-child
*/
}}
-functions.phpを作成。以下は親テーマがstyle.cssが一つで構成されている場合。
#pre{{
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}
}}

**子テーマでcssやjsを追加したい [#fdbf464b]
-[[WordPressでテーマからJavascriptやCSSを読み込む書き方まとめ | notnil creation weblog:http://notnil-creative.com/blog/archives/1299]]によると、function.phpで、add_actionして、その中でcssやら、jsやらを読みこめばいいらしい。
-hilight.jsを追加したいは、[[wordpressでhighlight.jsを利用する方法 | Transrain:http://transrain.net/blog/2014/09/05/145542]]のように。


**トラブルシューティング [#cd66509e]

***子テーマを使うとウィジェットがおかしい。 [#jfc499e8]
-外観 > ウィジェットで各ウィジェットの中身が入れ替わることがある?
-手動で戻すしかないっぽい。
*Tips [#i532bd80]
** 見出しに関して [#wd173238]
-記事の見出しはh2から始めるか、h3から始めるかという問題。
-テーマによって個別記事のタイトルがh1か、h2かさまざま。タイトルがh1なら見出しはh2から、h2ならh3から始めたほうがよさそう。だけど主流はh1をタイトルにして、見出しをh2から始める方式かもしれない。Twenty ElevenとかStinger3だとそうなっている。

**テーマをgitで管理する [#s0ae44fd]
-[[Vendor branches in git | Jabbering Giraffe:http://happygiraffe.net/blog/2008/02/07/vendor-branches-in-git/]]が参考になる。
#ref(wordpress_vendor_branch.png)

***手順1: 初回上流ソースをインポート [#la883dbc]
- supertheme.zipを展開しmasterにコミット。さらに今後のimport用にupstreamブランチを準備しておく。
#pre{{
  $ unzip supertheme.zip
  $ cd supertheme
  $ git init
  $ git add .
  $ git commit -m "Import supertheme 1.0"
  $ git tag v1.0
  $ git branch upstream
}}

***手順2: 上流ソースのアップデートに追随 [#he361caf]
-upstreamブランチに上流ソースをインポートしなおしてから、masterにmergeする。
#pre{{
  $ cd wordpress
  $ git checkout upstream
  $ rm -r *
  $ (cd .. && unzip supertheme-1.1.zip)
  $ git add .
  $ git commit -a -m 'Import supertheme 1.1'
  $ git tag v1.1
  $ git checkout master
  $ git merge upstream
}}

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS