私はいくつかの質問を検索したが、まだ問題がある。私はy'allからいくつかの専門知識を本当に感謝しています。 =)Wordpressの子テーマが@importの代わりにfunctions.phpを使用して読み込まれない
私のWordPressサイトで作成され、アクティブ化された子テーマは変更を行わないようです。
私は本質的にゼロのPHPを知っていますが、@importの代わりにfunctions.phpを使用しようとすると、読み込み時間が向上するはずです。ここで
は私の子供のテーマのディレクトリにstyle.css(第一)及び(二)のfunctions.php/*
Theme Name: Quest-Child
Description: No Coward's Quest Child Theme
Author: Jason from No Coward
Author URI: http://www.nocoward.com
Template: quest
Version: 1.0
*/
/* add padding to site description */
.site-description {
padding-top: 15px;
padding-bottom: 30px;
}
.body {
background: red;
}
/* can be found on "Services" page. Is the first ID within the <p> element */
#cc-m-12571703896 {
background: blue;
}
<?php
function my_theme_enqueue_styles() {
$parent_style = 'quest-all-css'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css');
wp_enqueue_style('child-style',
get_stylesheet_directory_uri() . '/style.css',
array($parent_style),
wp_get_theme()->get('Version')
);
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
?>
WordPressの子テーマを認識し、私はアクティブにするために許可された中で、私が持っているものですそれは成功しました。
CSSの要素は、自分の変更をレイアウトしている私の子供のテーマをテストするために使ったことです。何も現れません。
また、私はPHPの知識がゼロです。 the official WordPress "How to create a child theme"に基づいて、上記のコードをコピーして貼り付け、その指示に基づいて「親スタイル」の値を入力しようとしました。ここで私は、私は多分のfunctions.php「親スタイル」のために使用することができ、私の親テーマに見たものだ
...
// Enqueue required styles
wp_enqueue_style('quest-bootstrap', get_template_directory_uri() . '/assets/plugins/bootstrap/css/bootstrap.min.css');
wp_enqueue_style('smartmenus', get_template_directory_uri() . '/assets/plugins/smartmenus/addons/bootstrap/jquery.smartmenus.bootstrap.css');
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/plugins/font-awesome/css/font-awesome.min.css');
wp_enqueue_style('animate-css', get_template_directory_uri() . '/assets/plugins/animate/animate.css');
wp_enqueue_style('slit-slider', get_template_directory_uri() . '/assets/plugins/FullscreenSlitSlider/css/style.css');
wp_enqueue_style('colorbox', get_template_directory_uri() . '/assets/plugins/colorbox/colorbox.css');
wp_enqueue_style('Quest-style', get_stylesheet_uri(), array(
'quest-bootstrap',
'smartmenus',
'font-awesome',
'animate-css',
'slit-slider',
'colorbox'
));
...
// Enqueue required styles
wp_enqueue_style('quest-all-css', get_template_directory_uri() . '/assets/css/plugins-all.min.css');
wp_enqueue_style('Quest-style', get_stylesheet_uri(), array('quest-all-css'));
// Enqueue required scripts
wp_enqueue_script('quest-all-js', get_template_directory_uri() . '/assets/js/quest-and-plugins.js', array(
'jquery',
'masonry'
));
私は何をしないのですか?
ありがとうございます! -Jason