This is simple code to use WordPress tags as keywords meta tags. Use can make this as a plugin or just put it in a funtions.php file.
Ok, let’s start. Open your funtions.php in your themes directory. This funtions.php may vary depending on your using themes, so please try to find the correct file. At the end of the funtions.php file, before ?> please add the following code:

function bienthuy_meta_tags() {
$bienthuy_meta_tags = "";
if (is_home() || is_front_page() || is_page(array(425,'/')))
	{
$bienthuy_meta_tags .= "Biên Thùy, Bien Thuy, Lập Trình PHP MySQL, Tâm Linh, Xem Bói, Xem Giới Tính Thai Nhi";
	}
else  { 
$posttags = get_the_tags();
foreach((array)$posttags as $tag) {
		$bienthuy_meta_tags .= $tag->name . ',';
	}
}
	echo rtrim($bienthuy_meta_tags, ',');
}

Please replace “Biên Thùy, Bien Thuy, Lập Trình PHP MySQL, Tâm Linh, Xem Bói, Xem Giới Tính Em Bé” by your own keywords. These keywords will display in the home page.
Now save it and update it to your host.
Next, find header.php file, open it and look up for <?php wp_head(); ?>, before it, insert this line:

<!-- Start  BienThuy.Com keywords meta tags -->
<meta name="keywords" content="<?php echo bienthuy_meta_tags(); ?>" />
<!-- End  BienThuy.Com keywords meta tags -->

That’s it. Very simple. Now, go to your home page and random post to check if it works.
If you got any errors or questions, please comment below and Bien Thuy will happy to help you.

 

4.7/5 - (2326 bình chọn)

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *