WordPress website SEO code Optimization Tips

Source: Internet
Author: User
Keywords WordPress

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

Because of its powerful function, WordPress has many plug-ins and is easy to expand its function. Installation and use are very convenient, and free template plug-ins by many webmaster favorite, the production of low cost, site usability strong, so that most of the first webmaster industry owners choose to use WordPress as a station. WordPress To do blog, single page, Taobao guest site is a good choice.

In our use of WordPress to do the site, WordPress actually has a lot of shortcomings, such as WordPress can not be collected, published articles more trouble, these are just small problems, nothing more than to spend some time, But for webmasters, WordPress in the SEO support is very bad, this is the most fatal flaw, of course, you can use some SEO plug-ins to improve the problem, but plug-ins after all is plug-ins, there are always bad places, can change the way the code to change the problem, is not fundamentally resolved?

Let me introduce the way to change the code to do a good job of SEO knowledge

First: Homepage, section page, article page keyword, description one key setting

We are using WordPress to do the station when the most troublesome problem is the respective column page and article page keyword and describe the problem of setting up, at present we can only use plug-ins, in fact, by changing the code to set the keyword and description is the best way, I will introduce the following:

The keywords and description of the home page we can set up through the background, the trouble is the section page and the article page settings, we can change you use the template under the header.php to achieve.

Add the following code to the header.php

{

$description = get_option (' swt_description ');

$keywords = get_option (' swt_keywords ');

}

ElseIf (Is_category ())//Judgment Column page keyword and description

{

$ashu _categorys = Get_the_category ();

foreach ($ashu _categorys as $a) {

if ($a->name = = "column One") {

This is the name of one of your columns, there are only 2, there are more can also directly add

$keywords = "This is the key word of column one page";

}

if ($a->name = = "Column II") {

$keywords = "This is the key word of Column two page";

}

}

$description = Category_description ();

Here's a description of the program you set up backstage.

}

ElseIf (Is_single () | | | is_page ())//This is the keyword and description of the article page and the label page.

{

$description =get_post_meta ($post->id, "Description_value", true);

$keywords = Get_post_meta ($post->id, "Keywords_value", true);

Description: Here's Description_value, Keywords_value is in the writing article add custom column is added, in the following image: Click Add Custom Column, will Description_value, Keywords_ Value Plus, add once, later as long as the article, change the value on the line!

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

foreach ($tags as $tag) {$keywords = $keywords. $tag->name. ",";}

if ($keywords = = "") {

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

foreach ($tags as $tag) {

$keywords = $keywords. $tag->name. "

}

}

}

?>

Second: About the home page does not show a section of the article

We are writing articles, often in the home page to display some high-quality articles, there are many columns of the article is purely to increase the site included, may not be high quality, we do not want it to display in the home page, this is also very good to do.

First we have to find you do not want to show the ID of a column, which can be found in the background theme Settings page, if this column is ID 2, in your template index.php page to find the following code

$args = Array (

' Category__not_in ' => Array (2),//category ID not to be displayed, multiple separated by a half-width comma

' Paged ' => $paged

);

If you do not have category__not_in you add, you can also add multiple columns, such as ' category__not_in ' => Array (2,3,5)

Today brings two of WordPress website optimization skills, deficiencies please guide!

This article comes from the love collocation: http://www.941dp.com, respect the copyright, reprint indicates the origin!

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.