我花了几天时间研究编辑我的主题。我知道为了编辑父主题的页脚,我需要创建一个子主题。
这里是我的子主题文件夹,与其他主题处于同一级别。
正如你所看到的,我有
coeur-child 已创建文件夹。
这是该文件夹下的文件
以下是我的
style.css
儿童主题的
themes/coeur-child/style.css
/*
Theme Name: Coeur
Theme URI: http://frenchtastic.eu/theme/coeur
Description: Coeur Child Theme
Author: frenchtastic
Author URI: http://frenchtastic.eu/about
Template: Coeur
Version: 3.1.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl.html
Tags: blog, e-commerce, one-column, two-columns, left-sidebar, right-sidebar, custom-colors, editor-style, microformats, custom- background, custom-menu, featured-images, post-formats, sticky-post, theme-options, threaded-comments, translation-ready
Text Domain: Coeur-child
*/
在我的
themes/coeur-child/functions.php
<?php
function my_theme_enqueue_styles() {
$parent_style = \'coeur-style\'; // Coeur This is \'coeur-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\' );
?>
我将页脚从父主题复制到子主题文件夹
<!-- <button class="mobileCart">
<i class="fa fa-shopping-cart"></i>
</button> -->
<footer>
<?php if(is_active_sidebar(\'footer-1\') or is_active_sidebar(\'footer-2\') or is_active_sidebar(\'footer-3\')): ?>
<div class="footer-top">
<div class="container">
<div class="row">
<div class="col-sm-4">
<?php dynamic_sidebar( \'footer-1\' ); ?>
</div>
<div class="col-sm-4 md-footer-cl">
<?php dynamic_sidebar( \'footer-2\' ); ?>
</div>
<div class="col-sm-4">
<?php dynamic_sidebar( \'footer-3\' ); ?>
</div>
</div>
</div>
</div>
<div class="blog-footer blog-footer-widgets">
<div class="container">
<p class="site-credits">© <?php echo date(\'Y\'); ?> </p>
<p class="back-to-top"><a href="#"><i class="fa fa-angle-up"> </i> <?php echo __(\'Back to top\', \'coeur\'); ?><a></p>
</div>
</div>
<?php else: ?>
<div class="blog-footer">
<div class="container">
<p class="site-credits">© <?php echo date(\'Y\'); ?> - </p>
<p class="back-to-top"><a href="#"><i class="fa fa-angle-up"> </i> <?php echo __(\'Back to top\', \'coeur\'); ?><a></p>
</div>
</div>
<?php endif; ?>
</footer>
</div> <!-- end of wrap -->
<?php wp_footer(); ?>
</body>
</html>
出现以下错误
Broken Themes
The following themes are installed but incomplete.
Name Description
Coeur The parent theme is missing. Please install the "Coeur" parent theme. Delete Install Parent Theme
我正在使用WordPress 4.8版;WooCommerce版本3.1.0
我搜索了wp_enqueue_style
在我的父母身上coeur 文件夹但子文件夹未获取我的coeur-style.
有人能告诉我我做错了什么吗?