This is simple code to use wordpress tags as keywords meta tag. Use can make this as plugin or just put it in funtions.php file.
Ok, let’s start. Open your funtions.php in your themes directory. This funtions.php may vary depend on your using themes, so please try to find correct file. At the end of funtions.php file, before ?> please add the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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:
1 2 3 | <!-- 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 work.
If you got any errors or question, please comment below and Bien Thuy will happy to help you.
Same tags:
Other Posts you may be interested in:
- Quy y Tam Bảo là gì?
- How to fix “MTS files not importing in Premiere CC”
- Lịch thi đấu ngoại hạng Anh mùa giải 2015-2016
- Hostgator đang âm thầm khuyến mại 75% OFF
- Gộp nhiều email cùng chủ để – view email messages by conversation
- How to Hide a User Account from the Welcome Screen in Windows 10
- PHP – Chỉ cho chạy trên 1 domain
Last updated on March 10th, 2018 at 06:03 am