WordPress modified program to replace all SEO plug-in function

Source: Internet
Author: User
Keywords WordPress

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

I previously installed a Web site WordPress 2.3.2 version, because to try to keep the concept of simple Web page, plug probably only installed less than 5, which has installed all SEO pack This plug-in, although has been updated to a new version, but all SEO Pack This plug-in has been updated version, said really quite annoying, in the network to see some changes in the program of the article, also in accordance with their own needs to make some changes.

The main all SEO pack's function is to automatically help you add Title,meta keywords and description, and then to help you prohibit the search engine to some specific directory indexing, these functions can be done by themselves.

But I am also not hard-working people, just after installing all SEO pack incredibly strange, a lot of things are not come out, do not know is I will not use or how, but think about their own change, after the change all SEO pack plug stopped.

First open your header.php file before adding the following code:

        <?if (is_home () | | | is_page ()) {          $de scription = "When the page is displayed, the description you want is written here";         $keywords = "When the first page or pagination is displayed, the keyword you want is written here";         &NBSP} elseif (Is_single ()) {           $de scription = $post->post_excerpt;           $keywords = "";           $tags = wp_get_post_tags ($post->id);          foreach ($tags as $tag) {       $keywords = $ Keywords. $tag->name. “, “;         &NBSP} elseif (Is_category ()) {       $ Keywords = "When the directory is displayed, the keyword you want is written here";           $de scription = Category_description (); }?>        <metA name= "keywords" content= "<?= $keywords?>"/>          <meta Name= "description" content= "<?= $de scription?>"/>

Plus the above code, when the visit to your blog home page or pagination, will display the above keywords and description of the content (because the home page and pagination have no place to write your tag and description).

When you browse to your blog directory, the above keyword content is displayed (because there is no place to write your tag, but there are written descriptions).

When browsing to your single article, will automatically put your tag as a meta keyword content, you write in the article Description of the field automatically as a meta description of the content of your page is simple!! As for the title section, see how everyone does it, my title is the same way as the one that you add to the </head> tag before you can.

&lt;title&gt;&lt;?php if (Is_single ()) {the_title (); Echo ' | '; Bloginfo (' name '); else {bloginfo (' name '); Echo ' | '; Bloginfo (' description '); Wp_title (' | '); ?&gt;&lt;/title&gt; effect You can try for yourself, also calculate quite in line with the principle of SEO, finally, do not let search engine spiders will be some of your directory as an index, so as not to cause the same situation. Content reprint: http://www.chinaxianghui.com text copyright, reprint please keep the source link.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.