WordPressのテンプレートをカスタマイズしたり子テーマを作成したりするときに、テンプレートのパスが必要な場合があります。
そのようなときにテンプレートタグで返される値が、どのようなものか一見わかりづらいので確認の意味も込めてリストを作成しました。
リストの内容についてテンプレートタグの右が(親)テーマで使用したときの値で、その下(子テーマ)の右が子テーマでタグを使用したときの値になり、wpはWordPressのインストールフォルダ(ディレクトリ)名になります。
| テンプレートタグ | ファイル(アドレス)パス |
| get_stylesheet_uri() | http://localhost/wp/wp-content/themes/twentytwelve/style.css |
| (子テーマ) | http://localhost/wp/wp-content/themes/child-twelve/style.css |
| get_stylesheet_directory() | C:\wamp\www\wp/wp-content/themes/twentytwelve |
| (子テーマ) | C:\wamp\www\wp/wp-content/themes/child-twelve |
| get_stylesheet_directory_uri() | http://localhost/wp/wp-content/themes/twentytwelve |
| (子テーマ) | http://localhost/wp/wp-content/themes/child-twelve |
| STYLESHEETPATH | C:\wamp\www\wp/wp-content/themes/twentytwelve |
| (子テーマ) | C:\wamp\www\wp/wp-content/themes/child-twelve |
| get_template_directory() | C:\wamp\www\wp/wp-content/themes/twentytwelve |
| (子テーマ) | C:\wamp\www\wp/wp-content/themes/twentytwelve |
| get_template_directory_uri() | http://localhost/wp/wp-content/themes/twentytwelve |
| (子テーマ) | http://localhost/wp/wp-content/themes/twentytwelve |
| get_theme_root() | C:\wamp\www\wp/wp-content/themes |
| (子テーマ) | C:\wamp\www\wp/wp-content/themes |
| get_theme_root_uri() | http://localhost/wp/wp-content/themes |
| (子テーマ) | http://localhost/wp/wp-content/themes |
| TEMPLATEPATH | C:\wamp\www\wp/wp-content/themes/twentytwelve |
| (子テーマ) | C:\wamp\www\wp/wp-content/themes/twentytwelve |
スポンサーリンク


コメント