<!--functions.php-->
<?php
function learningWordPress_resources() {
wp_enqueue_style('style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'learningWordPress_resources');
我在从头开始编写代码的wordpress的导航栏下方收到消息“ class =“ home blog登录到admin-bar no-customize-support”>”。有人知道如何删除吗?如果是这样,将非常感谢您的帮助:)
(由于依赖于wordpress,因此附件代码不会在此处运行。希望附件图片足以说明情况)
/*
CSS:
Theme Name: Yonsei Fencing
Author: Yonsei Student
Version: 1.0
*/
<!--index.php-->
<?php
get_header();
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
<?php endwhile;
else:
echo '<p>No content found</p>';
endif;
get_footer();
?>
<!--header.php-->
<!DOCTYPE html>
<html> <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width">
<title><?php bloginfo('name'); ?></title>
<?php wp_head(); ?>
</head>
<body> <?php body_class(); ?>>
<!--site-header-->
<header class="site-header">
<h1><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1>
<h5><?php bloginfo('description'); ?></h5>
</header><!--/site-header-->
<!--footer.php-->
<footer class="site-footer">
<p><?php bloginfo('name'); ?> - © <?php echo date('Y');?></p>
</footer>
<?php wp_footer(); ?>
</body>
</html>
最佳答案
问题在于函数body_class()属于body
标记内,但是在您发布的代码中,它位于body
标记后。
如下更改代码,一切顺利:
由此,首先关闭body标签:
<body> <?php body_class(); ?>>
为此,它在body标签内包含
body_class
:<body <?php body_class(); ?>>
关于php - WordPress上的奇怪消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36517544/