wordpress get_header() on a page template getting the head content inside of the body tag


I am having trouble with my WordPress template page. When calling get_header() in the template page, the content of the head is appearing inside the body tag and causing trouble. I couldn’t find a solution for this.

This is what I mean :
inspect element

page template :

  * Template Name: sub services


 <h1>sub page</h1>


header.php :

<!DOCTYPE html>
   <html <?php language_attributes(); ?>>

     <meta charset="<?php bloginfo('charset'); ?>">
     <?php wp_title();?>
     <link rel="icon" type="image/png" href="/favicon.png">
     <link href="https://fonts.googleapis.com/css2?family=Lemonada:wghtOne Page Zen&display=swap" rel="stylesheet">
     <script src="https://kit.fontawesome.com/90928eb6b7.js" crossorigin="anonymous"></script>
     <?php wp_head(); ?>

   <body id="theme-body" <?php body_class(); ?>>
       <h1>Main Header</h1>

and I have added a page in wordpress admin and linked it to the template.

wordpress add page

Everything works fine except that the content of the head is in the body tag. when calling get_header(). In the template.php I have checked my error log and its fine. I dont know what is causing this problem or what I’m doing something wrong.

user198136 2 months 0 Answers 8 views 0

Leave an answer