J
J
Jokerrs5672021-11-05 16:07:26
WordPress
Jokerrs567, 2021-11-05 16:07:26

Header.php theme file under seo?

Need the right header for a static wordpress site. I can't find where to get seo-optimized header.php? Perhaps someone has a good example of header.php lying around, taking into account all the nuances for seo, which I could optimize for my solution

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Artem Zolin, 2021-11-06
@Jokerrs567

If by header you mean tag <head>, then you can only add this

<!doctype html>
<html <?php language_attributes(); ?>>
<head>
  <meta charset="<?php bloginfo( 'charset' ); ?>" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <?php wp_head(); ?>
</head>

The output of all other information is correctly connected and disconnected on the hook wp_head, the connection of scripts and styles is done on the hook wp_enqueue_scripts
. SEO markup of titles, descriptions and meta tags should be done using plugins, choose Yoast or Rank Math, you can't go wrong. In addition, you will need hooks wp_robotsand robots_txt, the first one prints tags in <head>, the second one creates a txt file. The sitemap works out of the box and is located at /wp-sitemap.xml

D
Dmitry, 2021-11-05
@pro100taa

Yoast Seo or Rank Math plugins won't work?

E
Evgeniy, 2021-11-05
@Evdokim001

What's the problem? If you are good at SEO or have someone who is, you can create a plugin yourself - unique. And use only what you need. In this case, you will have exactly what you need, while you will know how it works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question