2016-10-01 17 views
0

が、これは私のテストページのeコマースショップれるロードされていない https://colorlib.com/shapely子テーマは親テーマから全体のスタイルを

functions.php:

<?php 
function my_theme_enqueue_styles() { 

    $parent_style = 'parent-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'); 
?> 

整形式マスター(親)および滑らかな子供は、いずれもテーマフォルダ(同じ階層)。

これは私のすっきりと子style.css次のとおりです。

/* 
Theme Name: Shapely-Child 
Template: shapely 
Theme URI: https://colorlib.com/wp/themes/shapely 
Author: colorlib - modified by Sandra J./Amir R. 
Author URI: https://colorlib.com/ 
Description: [...] 
Version: 1.0.5 
License: GNU General Public License v2 or later 
License URI: http://www.gnu.org/licenses/gpl-2.0.html 
Text Domain: shapely 
[ ... ] 
*/ 

答えて

1

機能させるには、関数my_theme_enqueue_stylesのコードを次の変更コードで置き換えることができます。問題を解決するには

function my_theme_enqueue_styles() { 

    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css', array('shapely-bootstrap')); 
    wp_dequeue_style('shapely-style'); 
    wp_enqueue_style('shapely-style', 
     get_stylesheet_directory_uri() . '/style.css', 
     array('parent-style') 
    ); 
} 

私は、上述した後、あなたの子供のテーマのstyle.cssファイル

テンプレートに次の行を変更してきたように、関数my_theme_enqueue_stylesの変更を行ってください。すっきり

次の行を付けてください。

テンプレート:shapely-master

+0

あなたの返信をありがとう。残念ながら、これはトリックをしませんでした。私の側からの新しい情報が役立つかもしれませんか? Thx、Amir –

+0

お子様のテーマに関する詳細をお知らせいただきありがとうございます。上記の私の修正された答えを見てください。 –

+0

上記の共有関数my_theme_enqueue_stylesを変更しましたので、それを試してみてください。 –

0

このように、それは動作しません。

wp_enqueue_style($parent_style, get_template_directory_uri() . '/shop.amir-rahbaran.com/wp-content/themes/shapely-master/style.css'); 

をエンキューした結果が正しくないスタイルシートのパスがあるので:

../wp-content/themes/twentyfifteen/shop.amir-rahbaran.com/wp-content/themes/shapely-master/style.css 

websiを確認した後検査ツールを使ってソースコードを作成すると、動作しているようです。

私も、以下の機能をテストして、それが動作します:

function my_theme_enqueue_styles() { 

    $parent_style = 'parent-style'; 

    wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css'); 
} 
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles'); 

はまだあなたのために働いていませんか?

+0

よく動作しますが、完全ではありません。ボタンが正しく表示されません。これはどのように見えるのですか: https://colorlib.com/shapely/ –

関連する問題