Title: stinger3で子テーマを適応するとデザインが崩れる
Last modified: 2016年9月28日

---

# stinger3で子テーマを適応するとデザインが崩れる

 *  解決済 [akanez](https://ja.wordpress.org/support/users/akanez/)
 * (@akanez)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/)
 * 表題の件ですが、何回やってもデザインが崩れます。
    恐らくcssの読み込みが出来て
   ないと思うのですが…
 * 親テーマのフォルダ名は「stinger3」
    子テーマのフォルダ名は「stinger3-child」 
   子テーマの中にあるファイルは「style.css」と「function.php」のみで それぞれ下記
   コードを記載しております。
 * 「style.css」
 *     ```
       /*---------------------------------------------------------
       Theme Name: stinger3-child
       Template: stinger3
       Description: Customize css for stinger3
       Auther: Qtaro
       Author URI: http://room9.jp
       License:
       License URI:
       Version: 20131216 (for stinger3)
       ---------------------------------------------------------*/
       ```
   
 * 「function.php」
 *     ```
       <?php //子テーマで利用する関数を書く
   
       add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
       function theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '../stinger3ver20130925/style.css' );
   
       }
       ```
   
 * 上記２つのファイルをアップすると管理画面で子テーマとして認識されます。
    しかし、
   こちらを適応するとデザインが崩れてしまいます。
 * stingerのバージョンは、「stinger3ver20130925」となります。
 * 大変お手数ですがご確認よろしくお願い致します。

6件の返信を表示中 - 1 - 6件目 (全6件中)

 *  [mocomoco](https://ja.wordpress.org/support/users/silent_dandy/)
 * (@silent_dandy)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184489)
 * `get_template_directory_uri()`は末尾にスラッシュがつかないので、
 * `wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/../stinger3ver20130925/
   style.css' );`
 * 以上のようにすれば読み込むのではないかと思われます。
 *  [nobita](https://ja.wordpress.org/support/users/nobita/)
 * (@nobita)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184490)
 * こんにちは
 * 現状だと、stinger3ver20130925　の style.cssのコメントThemeNameをstinger3に変更
   していて、その状態でチャイルドテーマを作りたいという事ですよね。
 *     ```
       /*---------------------------------------------------------
       Theme Name: stinger3-child
       Template: stinger3
       Description: Customize css for stinger3
       Auther: Qtaro
       Author URI: http://room9.jp
       License:
       License URI:
       Version: 20131216 (for stinger3)
       ---------------------------------------------------------*/
       ```
   
 * 20131216 (for stinger3)の部分ですが、ここはチャイルドテーマのバージョンなので
   チャイルドテーマのバージョンを付けておいたほうがいいです。
 *     ```
       <?php //子テーマで利用する関数を書く
   
       add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
       function theme_enqueue_styles() {
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '../stinger3ver20130925/style.css' );
   
       }
       ```
   
 * たぶん@import ruleの書き方と混同してしまっているのではないかと思いますが、以下
   のように記述するといいだろうと思います。
 *     ```
       <?php //子テーマで利用する関数を書く
   
       add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
       function theme_enqueue_styles() {
       /*親テーマのバージョンは、以下で取得できます*/
       	$theme_parent_data = wp_get_theme('stinger3ver20130925');
       /*テーマのホルダー名もリネームしている場合は、stinger3ver20130925を書き換えてください*/
       	$theme_parent_data_version = $theme_parent_data->get( 'Version' );
   
           wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css',array(), $theme_parent_data_version, 'all' );
   
       }
       ```
   
 * これで、デザインの崩れは　おそらくなくなるだろうと思いますが、一つ大きな問題が
   あります。
 * このテーマだと、ヘッダーにスタイルシートの呼び出しがハードコーディングされてい
   ます。
 *     ```
       <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all" />
       ```
   
 * 親をwp_enqueue_style()等、標準的な方法で行うと、チャイルドテーマのＣＳＳが先に
   読み込まれて、それを上書きする形で親テーマのＣＳＳが読み込まれます。
 * 直ぐには問題になりませんが、カスタマイズを始めると諸問題が発生する可能性が高い
   です。（親と同じスタイルを書いても反映しないといった問題）
 * なので、functions.phpの記述をやめて、@importルールにしてしまうとかが手っ取り早い
   と思いますが、パフォーマンスなども気になって、wp_enqueue_style（）を採用したい
   といった事もあるでしょうから、
 * どうすればいいのかという点などに付いては、独自配布のテーマなので、配布元に質問
   してください。
 *  トピック投稿者 [akanez](https://ja.wordpress.org/support/users/akanez/)
 * (@akanez)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184498)
 * >>mocomocoさま
 * ご回答ありがとうございます。
    ご教授いただいた方法では、デザインが崩れたままで
   した。
 * >>nobitaさん
    ご回答ありがとうございます。 ご教授いただいた方法では、デザイン
   が崩れたままでした。
 * 一度配布元にも質問してみます。
    ありがとうございました。
 *  [nobita](https://ja.wordpress.org/support/users/nobita/)
 * (@nobita)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184504)
 * こちらで、実際に確認したのは、stinger3ver20140327 なので、バージョンの違いで何
   かあるのかもしれませんね。
 *  [천궁 메텔](https://ja.wordpress.org/support/users/digitmaetel/)
 * (@digitmaetel)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184506)
 * わたしはこれまで、Stinger 2, 3, Zero, 5 … そして現在は Stinger 6 を子テーマで
   使ってきましたが、問題にぶつかることはありませんでした。
 * バージョンが変わるごとに仕様が変わるというか、デザインが見た目のレイアウト、内部
   構造ともに違いのあるテーマも珍しいです。
 * だからか、アップデートのたびに子テーマを作りはしました。
 * 中には、作者のアドセンスコードが内部に残ったままだった、なんて事件も有りました
   から作者のサイトから安定バージョンをダウンロードしなおしたうえで、
    プラグイン
   を使って子テーマを作成してみるのも、試みてみてはいかが？
 *  トピック投稿者 [akanez](https://ja.wordpress.org/support/users/akanez/)
 * (@akanez)
 * [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184589)
 * >>nobitaさま
 * ありがとうございます。
    違うバージョンでも試したのですが駄目でした…。
 * >>맹조さま
 * ありがとうございます。
    こういった情報がネットに出ていないので、 かなり特殊な
   事例なのかもしれません…。 プラグインでの子テーマ作成も試してみます！ ありがとう
   ございます。

6件の返信を表示中 - 1 - 6件目 (全6件中)

 トピック「stinger3で子テーマを適応するとデザインが崩れる」には新たに返信すること
はできません。

## タグ

 * [CSS](https://ja.wordpress.org/support/topic-tag/css/)
 * [Stinger](https://ja.wordpress.org/support/topic-tag/stinger/)

 * フォーラム: [テーマ](https://ja.wordpress.org/support/forum/themes/)
 * 6件の返信
 * 4人の参加者
 * 最後の返信者: [akanez](https://ja.wordpress.org/support/users/akanez/)
 * 最後の活動: [10年、 7ヶ月前](https://ja.wordpress.org/support/topic/stinger3%e3%81%a7%e5%ad%90%e3%83%86%e3%83%bc%e3%83%9e%e3%82%92%e9%81%a9%e5%bf%9c%e3%81%99%e3%82%8b%e3%81%a8%e3%83%87%e3%82%b6%e3%82%a4%e3%83%b3%e3%81%8c%e5%b4%a9%e3%82%8c%e3%82%8b/#post-184589)
 * 状態: 解決済

## トピック

### 人気のトピック

### 返信がないトピック

### サポート関連ではないトピック

### 解決済みのトピック

### 未解決のトピック

### すべてのトピック
