2017-03-14 3 views
0

私は、人が似たような問題を抱えていることを知っていますが、ここでstackoverflowやWP Codexで質問を読んでもこの問題を解決できませんでした。 これは私が作った2番目の子供のテーマです。最初のものは完璧に働いた。何らかの理由で、私がすべてを同じようにしたとしても、これは親テーマのフォーマットを反映していません。私の疑念は、この特定のテーマのために複数の.cssをエンキューする必要があるか、または間違ったタグを持っていることです。 目の新しいセットが問題を見つけることを望む。ここでWordPressの子供向けテーマが書式設定されていない

は、子テーマのstyle.cssにある:

/* 
Theme Name: Kale-child 
Theme URI: https://panaceats.com/ 
Author: **** 
Author URI: https://panaceats.com/ 
Description: child theme of Kale 
Template: kale 
Version: 1.0.0 
License: GPLv3 or later 
License URI: http://www.gnu.org/licenses/gpl-3.0.en.html 
Text Domain: kale 
Domain Path: /languages/ 
Tags: one-column, two-columns, three-columns, right-sidebar, grid-layout, flexible-header, custom-background, custom-colors, custom-header, custom-menu, featured-images,footer-widgets, full-width-template, theme-options, threaded-comments, translation-ready, food-and-drink 
*/ 

そしてここでは、子テーマののfunctions.phpです:

<?php 
function my_theme_enqueue_styles() { 

$parent_style = 'kale-style'; 

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'); 
?> 

あなたが見ることができるように、私は続いていますWP Codex - CTからの道順。

Thisは、フォーマットがどのように見えるのでしょうか。

更新:親のstyle.cssのすべてのコンテンツを子にコピー/貼り付けすることで、親テーマのように見えるようになりました。しかし、これはエンキューの目的を破っていませんか?親と子が正しくエンキューされている場合、親からの書式設定は子テーマに反映されるべきではありませんか?

+0

header.phpの頭からスタイルを追加し、この愚かな機能を使用しないでください –

+0

"kale-style"は、style.cssを呼び出すときにKaleテーマがfunctions.phpで使用するのと同じハンドルですか? – Leland

答えて

0

あなたの子供のテーマの機能ファイルでこれを試してください。それは私のためのトリックをしたようだった。ここケース、他人の土地で

<?php 
 
\t add_action('wp_enqueue_scripts', 'enqueue_parent_styles'); 
 
\t 
 
\t function enqueue_parent_styles() { 
 

 
\t \t $deps = array('bootstrap', 'bootstrap-select', 'font-awesome', 'owl-carousel'); 
 
    \t \t wp_enqueue_style('kale-style', get_template_directory_uri() . '/style.css', $deps); 
 

 

 
\t 
 
\t \t } 
 
\t 
 
?>

関連する問題