2017-10-12 116 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');