Teach you three steps to optimize WordPress blog

Source: Internet
Author: User

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

WordPress These years very hot, because of its openness and rich templates, support plug-in expansion, more and more people to create a blog to start to choose WordPress. But there are still some friends first contact WP blog, do not know how to optimize, the author today on this issue to talk about how to do the Novice wordpress optimization.

Add keywords and description tags through code

WordPress in the title and description of the label on the approach is rather strange, he brought the program is not a keyword and description tag, and if we add through plug-ins and feel will slow down, based on this, we can use code to solve this problem:

  

<?php

Deciding whether to be the home page

if (Is_home ())

{

$description = "This is the homepage description tag";

$keywords = "This is the homepage keyword tag";

Determine if this is an article page

}

else if (Is_single ())

{

if ($post->post_excerpt)

{

$description = $post->post_excerpt;

else {

$description = Mb_strimwidth (strip_tags apply_filters (' the_content ', $post->post_content)

), 0,220);

}

$keywords = "";

$tags = Wp_get_post_tags ($post->id);

foreach ($tags as $tag) {

$keywords = $keywords. $tag->name. ","; }

Determine if it is a category page

else if (is_category ()) {

$description = Category_description ();

}

?>

<title><?php if (Is_home ()) {bloginfo (' name ');} elseif (Is_category ()) {single_cat_title (); if (Get_bloginfo ( ' name ')!= "") echo '-'; Bloginfo (' name '); }

ElseIf (Is_single ()) {Single_post_title ();}

ElseIf (Is_page ()) {bloginfo (' name '); if (Get_bloginfo (' name ')!= "") echo ': '; Single_post_title (); }

else {Wp_title (", True);}?></title>

<meta name = "keywords" content= "<?php echo $keywords;?>"/>

<meta name= "description" content= "<?php echo $description?>"/>

Put the above code in the WordPress blog's appearance---edit---anywhere in the top (header.php) file. This blog will automatically determine whether it is the home page, if it is the first page will be written in accordance with the key words and description tags, if not the homepage will automatically call the page tag as well as the content of the article as a keyword and description tag, so that the blog keyword and description of the label is perfect.

Second, the column set up and link the site pseudo static

WordPress in the column setup is very simple, as long as the article---categories can add columns. Column links can be controlled by aliases, as shown below

  

In the alias, you can set the link of this column, such as setting the alias of life story for Lifestory, then the link of this column is Www.xxx.com/category/lifestory, and the content in the description, will be extracted as a page description label content.

WordPress's pseudo static also do very good, he can select a variety of links in the background mode. In the Set---fixed link----custom, enter/%post_id% so after the article is published, the link displayed is www.xx.com/123, the following figure:

  

Third, the use of WP background production 301 redirect

Most of the time we want to redirect without www to the WWW address, usually need to modify the space Control Panel or through the Code to control, and WordPress let you remove the trouble, you need to do is just open the Web site backstage, in the settings---general---WordPress address (URL and the site address (URL) to fill in your with the WWW domain name, so easy to complete the site's 301 redirect.

Well, through the above steps, basically completed the initial optimization of WordPress, the rest of what you have to do is to concentrate on doing the article and the outside chain. This article from the true new full network original starting in http://www.kbc9.com/jingyanchuanbo/6.html, reproduced also please indicate the source, thank you.

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.