How can I show metadata for my front page only (wordpress)

Okey so I want to add metadata for the search engines but I only want them to be added on the front page. I have been trying diferent addons but they dont seem to be working so I was thinking of just doing it with good old simple code.

I am trying this right now

Read More
<?php
if ( is_home() ) 
{
?>

<meta name="DC.title" content="XXXXXXXX - XXXXXXXXX.se"/>
<meta name="title" content="XXXXXXXX - XXXXXXXXX.se"/>
<meta name="keywords" content="foo, bar, orange, testing" />
<meta name="DC.format" content="text/html"/>
<meta name="DC.publisher" content="XXXXXXXX"/>

<meta name="DC.Description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sodales neque a nibh blandit at iaculis est ultrices."/>
<meta name="description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sodales neque a nibh blandit at iaculis est ultrices."/>
<?php 
} 
else 
{
// This is not a homepage
}

but when I inspect the page with firebug the meta tags dont show on the front page or any other page. Any ideas?

Related posts

Leave a Reply

2 comments

  1. What did you mean by front page ?

    Anyways, actually is_front_page() returns true if the user is on the page or page of posts that is set to the front page on Settings and is_home() returns true when on the posts list page, this is usually the page that shows the latest posts. So try

    if(is_home() || is_front_page()){
        //...
    }
    

    instead of

    if (is_home()) {...}
    

    Hope it’ll work on both cases.