Home >Backend Development >PHP Tutorial >wordpress seo optimization_PHP tutorial

wordpress seo optimization_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:39:47876browse

All WordPress themes are basically not optimized and are not friendly to search engines. Without further ado, the Webmaster Effect Network is optimized through the following method. I hope it will be helpful to you.
1. Title optimization code, you can modify it accordingly according to your own site:
<?php if (is_home () ) { bloginfo('name') ; echo ” – Provide comprehensive Web page special effects and advertising code, commonly used js special effects and scripts on web pages."; } elseif ( is_category() ) { single_cat_title(); echo ” – "; bloginfo('name'); } elseif (is_single() is_page() ) { single_post_title();echo ” – “; $category = get_the_category();echo $category[0]->cat_name; echo ” – “; bloginfo('name'); } elseif (is_search() ) { bloginfo( 'name'); echo ” Search results: “; echo wp_specialchars($s); } else { wp_title(”,true); } ?>
2. For homepage, category page, and article Add keywords and description to the page:
$keywords = “”; $tags = wp_get_post_tags($post->ID);foreach ($tags as $tag) { $keywords = $keywords . $tag- >name . ” “; $description=$post->post_excerpt;} } elseif ( is_category(3) ){$keywords = “Navigation menu, hidden, scroll, tab, pop-up, left, transparent”; $ description = “Commonly used special effects for navigation menus, such as hiding effects, fade out, pop-up effects, etc. ”; }elseif ( is_category(4) ){$keywords = “Image special effects, picture switching, scrolling, picture display, amplification, fade, floating, transparent, dragging”; $description = “Common image effects on web pages, in websites Common special effects include picture switching, picture display, picture scrolling, picture floating, picture zooming, fading and other special effects. ”; }elseif ( is_category(5) ){$keywords = “Date effects, countdown, countdown, clock, calendar, acquisition, perpetual calendar, pop-up”; $description = “Very practical js date effects, such as web clock script, Timing, countdown script, text box date selection, etc. "; }elseif ( is_category(6) ){$keywords = "Color effects, gradients, background colors, color matching, color changing, flashing"; $description = "Web page color effects, js control background color or color changing and other web page special effects are all collected Here it is. ”; }elseif ( is_category(7) ){$keywords = “Text effects, timing, flashing, double-click, pop-up, scrolling”; $description = “Collect the most comprehensive text effects, such as text scrolling, timing display, flashing effects, Double click, pop-up effect, scrolling effect. "; }elseif ( is_category(8) ) {$keywords = "Form button, text box, limit, button, input box, list box, select all, invert selection, copy, context menu, drop-down menu, jump, linkage menu, Timing, pop-up, acquisition"; $description = "Very comprehensive form button special effects. Commonly used effects include select all, invert selection, js to obtain parameter values, linkage menu and other web page special effects. ”; } elseif ( is_category(9) ){$keywords = “Window effects, pop-up, pop-up window, expand, lower right corner, prompt layer, frame, timing, prompt window”; $description = “Web page window special effects tips, website Commonly used web page effects such as pop-up windows in the lower right corner, window pop-ups, prompt layers, frames, etc. ”; } elseif ( is_category(10) ){$keywords = “Table layer, prompt layer, alternate row color change, scroll bar, cell, drag, hide, shrink, pop-up”; $description = “Web page table layer A gathering place for special effects, including common web page effects such as changing colors on alternate rows, dragging tables, hiding layers, popping up layers, etc. "; } elseif ( is_category(11) ){$keywords = "Mouse effects, click, disable, right click, mouse sensing, follow"; $description = "Mouse effects are also a very common web page special effect, used on many websites Disabling right-click and mouse sensing is a good example. ”; } elseif ( is_category(12) ){$keywords = “Tab, jump, match, prohibit, get, radio button, generate”; $description = “Web page comprehensive special effects, a relatively complex web page special effect, Several special effects are often combined to achieve the final effect. ”; } elseif ( is_category(13) ){$keywords = “Advertising code, image switching, upper right corner, image display, couplet, image switching, scaling”; $description = “The most comprehensive collection of advertising codes, commonly used on websites The only thing is the image switching effect, and there are all kinds of ad code types. "; } elseif ( is_category(14) ) {$keywords = "Webmaster news, webmasters make money, website makes money, web development, website operation, website profit"; $description = "Webmasters often read articles, consider how to operate website to achieve profit-making purposes.”; } ?>
” />
” />
The number in the middle of is_category(4) is the id of each category. If you don’t know the database, you can restore it to the default link. Then move the mouse over the navigation and see ?cat=XXX in the lower left corner. The following number is the category. ID.
The article title can be set like this: Article name》Category name》Website name. How to get the category name? The above code is this:cat_name; ?>
The above are all modified in header.php in the theme directory. The template names of each theme should be the same. If they are not the same, you can find the header file yourself.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486269.htmlTechArticleWordpress themes are basically not optimized and are not friendly to search engines. Not much nonsense, webmaster The special effects network is optimized through the following method. I hope it will be helpful to you. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn