<!--functions.php-->
<?php
function learningWordPress_resources() {
wp_enqueue_style('style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'learningWordPress_resources');
I get the message “class=”home blog logged-in admin-bar no-customize-support”>” below my navigation bar in the wordpress I am coding from scratch. Does anyone know how to remove this? If so, your help would be much appreciated : )
(The attached code won’t run here because it’s dependent on wordpress. Hopefully, the attached picture is enough to explain the situation)
/*
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>
The issue is that the function body_class() belongs inside your
body
tag, but in the code you’ve posted, it’s after thebody
tag.Change your code as follows, and you’re good to go:
FROM this, which closes the body tag first:
TO this, which contains the
body_class
inside the body tag: