I have installed Wordpress 2.3.2 on one of my previous websites, because I want to keep the simple concept of web pages as far as possible, there may be less than five plug-ins, the plug-In "All-In-One SEO pack" has been installed. Although it has been updated to a new version, the plug-In "All-In-One SEO pack" has been updated, it is really annoying. I saw some articles about modifying programs on the Internet and made some modifications according to my own needs.
The main function of All-In-One SEO pack is to automatically add Title, meta keywords, and description to you, and then disable search engines from indexing certain directories, these functions can be implemented by yourself.
However, I am not a hard-working person, But it is strange to install the All-In-One SEO pack. I don't know whether to use it or not, but if you want to change it, you can stop the All-In-One SEO pack plug-In after the change.
First open your header. php file and add the following code:
<? If (is_home () | is_page () {$ description = "when a homepage or page is displayed, you need to write the description here "; $ keywords = "when the homepage or page is displayed, you need to write the keyword here";} elseif (is_single () {$ description = $ post-> post_excerpt; $ keywords = ""; $ tags = wp_get_post_tags ($ post-> ID); foreach ($ tags as $ tag) {$ keywords = $ keywords. $ tag-> name. "," ;}} elseif (is_category () {$ keywords = "when displaying the path directory, you need to write the keywords here "; $ description = category_description () ;}?> <Meta name = "keywords" content = "<? = $ Keywords?>" /> <Meta name = "description" content = "<? = $ Description?>" />
After the code is added, when a visitor visits your Blog homepage or pages, the above keywords and descriptions are displayed (because there is no place to write your tag and description on the homepage and pages ).
When browsing your Blog directory, the above keywords will be displayed (because the category directory has no place to write your tag, but there is a place to write the description ).
When browsing your single article, your tag is automatically used as the meta keyword content, it's easy to use the field you wrote in the description of the article as the description of the meta On Your webpage !! As for the title, let's see how everyone works. My title is added to the <Title> <? Php if (is_single () {the_title (); echo '|'; bloginfo ('name');} else {bloginfo ('name'); echo '| '; bloginfo ('description'); wp_title ('|') ;}?> </Title> you can try the effect on your own, which is quite in line with the SEO principles. Finally, do not let the search engine spider index some of your directories, so as not to cause the same content. Content reprint: http://www.chinaxianghui.com text copyright, reprint Please retain the source link.