• OK so I actually know a decent amount of html and css and am learning the wordpress php commands pretty quickly, but this is one thing I still don’t get. What info do I need to place in the <head> tag of a new theme? And the <html> tag for that matter. For example, I’ve seen things such as:

    <html xmlns="https://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    
    <head profile="https://gmpg.org/xfn/11">
    	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    I understand what the meta tag does, but not the rest. Also, where do put doctype? I know these are stupid questions but I’ve searched and come up empty. If there’s a codex page with this info a link to it is all I really need, I just haven’t been able to find it. Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I asked myself the same question when I started coding years ago. I downloaded several themes and just compared them all. They are all different, but I’ve come to the conclusion that having the following is ok and that’s what I use now for all of my themes.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head profile="https://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php if (is_home()) : ?><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?>
    <?php else : ?><?php wp_title('', 'false'); ?> - <?php bloginfo('name'); ?>
    <?php endif; ?></title>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php wp_head(); ?>
    </head>
    Thread Starter wdawson

    (@wdawson)

    Thanks a lot, I mean I basically understand everything there (except for the php which generates the title), I just wanted to make sure I include everything I need to and nothing I don’t.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘stupid question – what is needed in the <head> tag?’ is closed to new replies.