Я работаю над проектом в теме wp-bootstrap-starter-child, и я установил плагин aceIDE. Я понятия не имею, как работает код PHP, и проблема в том, что мои страницы не могут ссылаться на мой style.css.
Это сработало в другом проекте, но когда я попытался реализовать этот код в своем проекте, это не так.
Вот мои страницы: header.php:
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package WP_Bootstrap_Starter
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'wp-bootstrap-starter' ); ?></a>
<?php if(!is_page_template( 'blank-page.php' ) && !is_page_template( 'blank-page-with-container.php' )): ?>
<header id="masthead" class="site-header navbar-static-top <?php echo wp_bootstrap_starter_bg_class(); ?>" role="banner">
<div class="container">
<nav class="navbar navbar-expand-xl p-0">
<div class="navbar-brand">
<?php if ( get_theme_mod( 'wp_bootstrap_starter_logo' ) ): ?>
<a href="<?php echo esc_url( home_url( '/' )); ?>">
<img src="<?php echo esc_url(get_theme_mod( 'wp_bootstrap_starter_logo' )); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
</a>
<?php else : ?>
<a class="site-title" href="<?php echo esc_url( home_url( '/' )); ?>"><?php esc_url(bloginfo('name')); ?></a>
<?php endif; ?>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-nav" aria-controls="" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'container' => 'div',
'container_id' => 'main-nav',
'container_class' => 'collapse navbar-collapse justify-content-end',
'menu_id' => false,
'menu_class' => 'navbar-nav',
'depth' => 3,
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker()
));
?>
</nav>
</div>
</header><!-- #masthead -->
<?php if(is_front_page() && !get_theme_mod( 'header_banner_visibility' )): ?>
<div id="page-sub-header" <?php if(has_header_image()) { ?>style="background-image: url('<?php header_image(); ?>');" <?php } ?>>
<div class="container">
<h1>
<?php
if(get_theme_mod( 'header_banner_title_setting' )){
echo get_theme_mod( 'header_banner_title_setting' );
}else{
echo 'WordPress + Bootstrap';
}
?>
</h1>
<p>
<?php
if(get_theme_mod( 'header_banner_tagline_setting' )){
echo get_theme_mod( 'header_banner_tagline_setting' );
}else{
echo esc_html__('To customize the contents of this header banner and other elements of your site, go to Dashboard > Appearance > Customize','wp-bootstrap-starter');
}
?>
</p>
<a href="#content" class="page-scroller"><i class="fa fa-fw fa-angle-down"></i></a>
</div>
</div>
<?php endif; ?>
<div id="content" class="site-content">
<div class="container">
<div class="row">
<?php endif; ?>
functions.php:
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):
function chld_thm_cfg_locale_css( $uri ){
if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )
$uri = get_template_directory_uri() . '/rtl.css';
return $uri;
}
endif;
add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );
if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
function chld_thm_cfg_parent_css() {
wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'wp-bootstrap-starter-bootstrap-css','wp-bootstrap-starter-fontawesome-cdn' ) );
}
endif;
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
// END ENQUEUE PARENT ACTION
hotel.php, который использовался для шаблона моих страниц:
<?php
/**
* Template Name: Hotel
*/
get_header(); ?>
</div>
</div>
<section id="primary" class="content-area col-sm-12">
<main id="main" class="site-main" role="main">
<?php
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content', 'page' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_footer();
?>
Я не знаю, чего мне не хватает, потому что я не очень хорошо знаю PHP, поэтому все, что я сделал, это скопировал код из другого проекта и реорганизовал его очень мало PS: извинитедля моего английского