There is a problem with WordPress, that is, the lack of keywords and description information on the page. In fact, this work should be completed by the topic. Unfortunately, most of the topics are not involved, which leads to the lack of the two information.
WordPress has a problem, that is, the lack of keywords and description information on the page. In fact, this task should be completed by the topic. Unfortunately, most of the topics are not involved, therefore, the lack of these two information is very unfavorable for SEO. The following describes how to use a non-plug-in to call keywords and description in the template. Directly on the code, the following is the topic of the Tianya PHP blog [http://blog.phpha.com] code, you can modify it according to the actual situation, you can leave a message if you do not understand.
- <? Php <li> if (is_category () {<li> single_cat_title (); <li >} elseif (is_single () | is_page ()) {<li> single_post_title (); <li >}elseif (is_search () {<li> echo wp_specialchars ($ s ); <li >}else {<li> wp_title ('', true); <li >}< li> if (! Is_home () {<li> echo '-'; <li >}< li> echo 'tianya PHP blog | PHP blog'; <li >?>
-
// Http://blog.phpha.com
- If (is_page ()){
- $ Description = mb_strimwidth (strip_tags (apply_filters ('The _ content', $ post-> post_content), 0,200 ,'...');
- $ Keywords = $ post-> post_title;
- } Elseif (is_category ()){
- $ Description = trim (strip_tags (category_description ($ cat_ID )));
- $ Keywords = single_cat_title ('', false );
- } Elseif (is_tag ()){
- $ Keywords = single_tag_title ('', false );
- $ Description = trim (strip_tags (tag_description ($ tag_ID )));
- } Elseif (is_single ()){
- If ($ post-> post_excerpt ){
- $ Description = $ post-> post_excerpt;
- } Else {
- $ Description = mb_strimwidth (strip_tags (apply_filters ('The _ content', $ post-> post_content), 0,200 ,'...');
- }
- $ Keywords = $ post-> post_title;
- } Else {
- $ Keywords = 'php blog, PHP, MySQL, Linux, C, programming algorithm, website architecture, internet ';
- $ Description = 'focus on WEB development and love PHP/MySQL/Linux/C/programming algorithms/website architectures, advocating free Internet access ';
- }
- ?>
-
-