1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【備忘録】WordPress子テーマの設定

Posted at

はじめに

 今日はWordPressの子テーマについて書いていきたいと思います!
 子テーマを使うことでWordPressのバージョンアップをしたときに、
 データの上書きで大事なデータがなくなってしまわぬようにすることができます。

子テーマの作り方

 子テーマは「style.css」と「functions.php」の2つののファイルが必要になります。
 「style.css」には


/*
Template:Original
Theme Name:Original_child
*/

「function.php」には


<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); 
    function theme_enqueue_styles() 
    { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); 
} ?>

 この2つを準備すれば子テーマが使用できます。
 直接テーマを変更せずに子テーマ内に新しくファイルを作ったりstyle.cssに記述していきましょう。

最後に

 今回は子テーマについて勉強しました。次回をプラグインについて書いていきたいと思います。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?