I want to add the separate meta tags for the each page using the header.php
To add the title,Meta Description,Meta Keywords of the every page
for better SEO Anlayis. I want achieve this through code on header.php page.
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<!--<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />-->
<style>
/*.alignleft { left:0px !important;}
*/
</style>
<title>
<?php
/*
* Print the <title> tag based on what is being viewed.
*/
global $page, $paged;
wp_title( '|', true, 'right' );
// Add the blog name.
bloginfo( 'blogname' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s'), max( $paged, $page ) );
?>
</title>
</html>
Thanks in advance.
2
Answers
The easy way is use a hook using condition.
Simply use this code to your
functions.php
but change englishis_page('english')
to yourpage_ID
orslug
ortitle
Hi can i do this with the nromal phpo website?
function add_meta_data_firefog() {
}
add_action(‘wp_head’, ‘add_meta_data_firefog’);