Hello, how can we give unique title, meta description and keyword tag for home page of wordpress blog. i have blog name www(.)eltalearning(.)com i am unable to give unique title and meta tags for home page. please suggest me. i already used all in one seo pack plug ins and it is working fine for category pages. but not working for home page. thanks
You can use custom fields with the following hack: Place this within the "functions.php" file in the theme folder. <?php /* get the custom field value outside the loop */ function get_custom_field($field){ global $wpdb; global $post; $post_id = $post->ID; $now = current_time('mysql'); $sql = "SELECT meta_value FROM $wpdb->posts AS posts, $wpdb->postmeta AS postmeta "; $sql .= "WHERE posts.ID = postmeta.post_id AND postmeta.post_id = $post_id AND postmeta.meta_key = '$field' "; $sql .= "AND ( posts.post_status = 'publish' OR posts.post_status = 'static' ) "; $sql .= "AND posts.post_date < '$now' AND postmeta.meta_value != ''"; $results = $wpdb->get_results($sql); if (!empty($results)) foreach ($results as $result) { $value .= $result->meta_value . " "; }; return $value; } ?> Code (markup): And this in the "header.php": <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php require_once get_template_directory()."/functions.php"; $title_content = get_custom_field('title'); $description_content = get_custom_field('description'); ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-GB"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php if (is_home()) { bloginfo('name'); echo " - "; bloginfo('description'); } else { if($title_content!=""){echo $title_content;} else {the_title ();} echo " - "; bloginfo('name'); } ?></title> <?php if($description_content!=""){ echo "<meta name=\"description\" content=\"$description_content\" />"; } ?> Code (markup): Than within your pages and posts use custom fields "title" for the title tag and "description" for the meta description. Meta description will only help you to get some more clicks if you write them in a compelling writing style. Do not stuff Meta description with keywords. Google do not care about those. Yes, and forget about meta keywords, it is absolutely useless these days.