craftdeer
craftdeer

Reputation: 1025

Adding wp_head() in wordpress header makes everything in body disappear

I am starting with wordpress and after adding dynamic heading <?php wp_head(); ?> everything in the body disappears.

this is my header.php file

 <!DOCTYPE html>
  <html <?php language_attributes(); ?>>
   <head>
   <meta charset="<?php bloginfo('charset');?>">
   <title><?php bloginfo('name');?> | <?php wp_title();?></title>
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <link href="<?php bloginfo('template_url'); ?>/css/bootstrap.css" rel="stylesheet">
   <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet">
   <?php wp_head(); ?>
  </head>

When I remove the <?php wp_head(); ?> line, everything in the body shows. I am told that including the line is a must in wordpress.

Upvotes: 0

Views: 823

Answers (1)

caiovisk
caiovisk

Reputation: 3809

On your header.php you have to call:

<?php wp_head(); ?>

On your internal pages, like index.php you have to call:

<?php get_header(); ?>

See:https://codex.wordpress.org/Theme_Development

Also you can turn your debug mode on in order to identify the errors. https://codex.wordpress.org/Debugging_in_WordPress

Upvotes: 1

Related Questions