2017-10-12 168 views
0

我想創建一個在父主題多於一個樣式表文件的Wordpress中的twentyfifteen兒童主題。 這條路線是的htdocs/WordPress的-1 /可溼性粉劑內容/主題/ twentyfifteen孩子所以要根據這裏類似的問題孩子的代碼應該是:Style.css&functions.php在兒童主題Wordpress

的style.css:

/* 
Theme Name: Twenty Fifteen Child 
Theme URI: http://localhost/wordpress-1/wp-content/themes/twentyfifteen-child/ 
Description: My first child theme, based on Twenty Fifteen 
Author:  Daniel Pataki 
Author URI: http://danielpataki.com 
Template:  twentyfifteen 
Version:  1.0.0 
Tags:   black, green, white, light, dark, two-columns, three-columns, left-sidebar, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready, accessibility-ready, responsive-layout, infinite-scroll, post-slider, design, food, journal, magazine, news, photography, portfolio, clean, contemporary, dark, elegant, modern, professional, sophisticated 
Text Domain: twenty-fifteen-child 
*/ 

功能。 PHP:

<?php 

    function enqueue_parent_styles() { 

    wp_enqueue_style('twentyfifteen-editor-style', get_template_directory_uri().'css/editor-style.css',array(), null, 'all'); 
    wp_enqueue_style('twentyfifteen-ie', get_template_directory_uri().'css/ie.css',array(), null, 'all'); 
    wp_enqueue_style('twentyfifteen-ie7', get_template_directory_uri().'css/editor-ie7.css',array(), null, 'all'); 
    wp_enqueue_style('twentyfifteen-style', get_stylesheet_uri(), '', null, 'all'); 
} 


add_action('wp_enqueue_scripts', 'enqueue_parent_styles'); 

?> 

父內容(樣式表)的路徑是: 的htdocs/WordPress的-1 /可溼性粉劑內容/主題/ twentyfifteen/CSS 但還是在主題選擇頁面沒有預覽的孩子t血紅素和加載主題時,沒有從父主題(twentyfifteen)加載的css規則。我找不到問題,如果有人可以幫我..

+0

有一個WordPress問題的網站:http://wordpress.stackexchange.com – mmm

回答

0

看起來像你沒有入隊父母的CSS的風格。在您的兒童主題的function.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');