Remove unnecessary header in wordpress - php

I was just working with wordpress and managed to get my site up. Now i am getting this unnecessary header in my site (the black header ... right at the top), see below:
.
My header code looks like below:
<!doctype html>
<html <?php language_attributes(); ?> >
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php bloginfo('name'); ?></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="style.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header class="site-header">
<h1><?php bloginfo('name'); ?></h1>
<h5><?php bloginfo('description'); ?></h5>
<nav class="site-nav">
<?php
$args = array(
'theme_location' => 'primary'
);
?>
<?php wp_nav_menu($args); ?>
</nav>
</header>
I am new to workpress and just beginning to learn stuff.
How can i remove this header?
Thank you.

Wordpress shows this admin bar by default when you are logged in in the backend. Non-admin users will not see it, but you can disable this in your profile if you want.
Go to Users -> Your profile
Disable the option Show toolbar when viewing site

remove this line, the header will goes hide
<?php wp_head(); ?>

Related

Wordpress White Screen of Death after activate own theme

I'm trying to create my new own theme for wordpress (and the first one) and I encounter that my site isn't loading the header nor the content of index.php. It's pretty strange, I've read the WP WSoD documentation but I couldn't find anything helpful since my theme only have a couple of lines, I don't see the problem.
This is my theme structure:
And I've only edited index.php, header.php and footer.php. My functions.php seems to have something but I just added some lines to test, it's now blank again.
And this is what's inside my header.php:
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title> <?php bloginfo( 'name' ); ?> </title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="<?= get_template_directory_uri() ?>/assets/css/bootstrap.min.css">
<!-- Natural Stylesheet -->
<link rel="stylesheet" href="<?= get_template_directory_uri() ?>/style.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="<?= get_template_directory_uri(); ?>/assets/img/favicon.png"/>
</head>
<body>
This is what's inside my footer.php:
<script type="text/javascript" src="<?= get_template_directory_uri(); ?>/assets/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="<?= get_template_directory_uri(); ?>/assets/js/popper.js"></script>
<script type="text/javascript" src="<?= get_template_directory_uri(); ?>/assets/js/bootstrap.min.js"></script>
</body>
</html>
And this is what I've inside my index.php:
<?php get_header(); ?>
<?php while( have_posts() ) the_post(); ?>
<?php get_footer(); ?>
I edited index.php and WordPress was loading front-page.php

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.
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

Rogue &nbsp in Wordpress blog

I have a weird problem with my Wordpress blog.
&nbsp is inserted right after the <body> tag. There's no &nbsp in the header.php file, though. It's just the <body> tag and then a <div>.
Is there any way to stop this?
Thanks in advance!
EDIT |
This is the header.php:
<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="profile" href="<?php echo esc_url( 'gmpg.org/xfn/11' ); ?>">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="wrapper">
<?php do_action('__before_header') ; ?>
<?php hu_get_template_part('parts/header-main'); ?>
<?php do_action('__after_header') ; ?>
<div class="container" id="page">
<div class="container-inner">
<?php do_action('__before_main') ; ?>
<div class="main">
<div class="main-inner group">
<?php do_action('__before_content') ; ?>
What is ?
It's good explained here
How to remove from html?
You should find beetwen which html tags it's occured and delete all spaces which are between that tags.
Considering discussion on your question: after body tag you got . So, just removing spaces after <body> from header.php of your wordpress child and parent themes stops rendering .

Is dynamically Adding Meta Tag Using PHP is SEO friendly

I have a doubt that adding dynamically the meta tags using server script can minimize scope of SEO friendly can anyone tell it good or not to do that ?
//Header1.php
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $title ;?></title>
<meta name="description" content="<?php echo $title ;?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
</html>
//home.php
<?php
$title="Portfolio";
include ('../assets/includes/header1.php');
?>
<section id="portfolio" class="portfolio text-center">
<div class="portfolio-bottom">
<div class="section-padding">
</div>
</div>
</section>
<?php
include ('../assets/includes/footer.php');
?>

How to make WordPress menu items?

I am learning WordPress and basically I have this very simple site, I have the following header file:
<!doctype html>
<html <?php language_attributes(); ?> >
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php bloginfo('name'); ?></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="style.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header class="site-header">
<h1><?php bloginfo('name'); ?></h1>
<h5><?php bloginfo('description'); ?></h5>
<nav class="site-nav">
<?php
$args = array(
'theme_location' => 'primary'
);
?>
<?php wp_nav_menu($args); ?>
</nav>
</header>
Now I believe, the menu is actually created by the below line of code:
<?php wp_nav_menu($args); ?>
Now when I check in the Front End, i.e. I load my site, I see that the only item in my menu is "sample-page", I was following from 1:38 onwards HERE and you'll see how this guy get a menu with "about us", "home", "contact" etc…
Now why am I not getting the same and how can I create those menus?
To create your own menu, you need to first go to your wp-admin dashboard. Then go to Appearance/menus.
Here you can create your own menus, or modify existing menus. After you do this, choose the role of the menu from the near footer of the page, just before the "Save menu" option.
And I hope you're all done!
Your code is attaching the 'primary' theme location to wp_nav_menu. Go to your dashboard Appearance>Menu page and see if you have a Primary menu in
the dropdown next to 'Select a menu to edit'. If so, select it. The pages in that menu should show. You can add to them as needed.

Categories