WordPress no plugin automatically displays thumbnails

Like toss to modify the wordpress theme friends, certainly encountered such a problem, would like to show thumbnails in the home page, there are plug-ins can be achieved, but not easy to operate and control, after all, the code is written, and today to share with you, No plug-in, pure code is how to achieve the first page of the article thumbnails, the method is very simple, even if you do not understand the code, according to the steps can also be. Of course, the thumbnail is selected in the article in the first picture, if the article does not contain pictures, show the default picture, so you have to set a default picture location.
Into the topic, start to add the first page thumbnail, simple 3 steps can be achieved:

The first step: find the use of the theme template function.php file in the <? Php and?> Add the following code:
function thumb_img ($ soContent) {
$ soImages = ‘~ <img [^ \>] * \ /> ~’;
preg_match_all ($ soImages, $ soContent, $ thePics);
$ allPics = count ($ thePics [0]);
if ($ allPics> 0) {
echo “<span id = ‘thumb’>”;
echo $ thePics [0] [0];
echo ‘</ span>’;
}
else {
echo “<span id = ‘thumb’>”;
echo “<img src = ‘”;
echo bloginfo (‘template_url’);
echo “/images/thumb.gif ‘> </ span>”;
}
}
This is a method of displaying thumbnails, automatically retrieving the first picture of the article, and if you do not show the current theme /images/thumb.gif so you should have this thumb.gif picture ready.

The second step: find the index.php file that is the first page file, find the_content (); or similar code before it add the following code:
thumb_img ($ post-> post_content);
This call the method just now, in fact, the thumbnail has been completed. But you see the effect must be very unexpected, the size of the picture should be no control, will be ugly.

Step 3: Add thumbnail style CSS code:
This is the cloud station used in the thumbnail style, you can make do with the use, and then modify it
#thumb {margin: 5px 15px 5px 5px; width: 145px; height: 120px; border: 3px solid #eee; float: left; overflow: hidden;}
#thumb img {max-height: 186px; max-width: 186px}

Well, so there is a thumbnail showing a kind of show it.

How does WordPress replace domainname?

Open a personal blog friends use WordPress a few, then it is inevitable that the replacement of space and domain name, because the author experienced a replacement space and domain name, the blog changed from AAA.com to BBB.com, so this article to share Replace the domain name better way.
WordPress we all know that the background needs to set the site’s default URL, if the direct replacement of the domain name, then use the new domain name is unable to login. There are many articles on the Internet, tell you can modify the MySQL database, or modify the WordPress wp-config.php file or function.php file, in fact, not so much trouble.
As long as the replacement before and after the domain name in their own hands, then the solution is very simple. First change the domain name before and after the analysis are resolved to the blog space, that is, so that the old and new domain name can correctly access the blog. To determine whether the old and new domain name can be properly accessed, in addition to their own local direct access to the two domain names can be properly accessed to the site, but also need to see other areas of domain name access is normal, because Telecom, China Unicom, there are different areas of DNS effective time is different of. At this time the station owners have a good tool, but the use of super ping (http://ping.chinaz.com), the old and new domain names were entered into the super ping, to see whether all over the ping .
If you determine the old and new domain names are parsed after the normal, you can change the domain name, and in a word called witness the miracle of the moment.
With the administrator login WordPress background, click Settings → General, inside the WordPress address (URL) and site address (URL) are modified to a new domain name, and then click Save Changes. Hey, ye quit, in fact, is a success, look at the browser’s address bar is not a new address? Log in with the administrator account, look at the settings → routine is not a new domain name? And then click on the home page to see if it is not a new domain name, if you enter the old domain name will not jump to the new domain name It is clear that the change is successful, is not very simple.
But because of the blog article in some of the links and picture address or use the old domain name, so also need to make some changes.
Login phpmyadmin, select your own database of the blog, and then click SQL, enter the following three lines of command:
UPDATE wp_posts SET post_content = replace (post_content, ‘AAA.com’, ‘BBB.com’);
UPDATE wp_comments SET comment_content = replace (comment_content, ‘AAA.com’, ‘BBB.com’);
UPDATE wp_comments SET comment_author_url = replace (comment_author_url, ‘AAA.com’, ‘BBB.com’);
And then click on the implementation, if there is no error, then the article and the comments will be replaced in all the addresses.
This time with a new address to visit it, the domain name to replace the perfect.

WordPress articles are automatically added at the bottom of the copyright notice and links

Now write a blog is not easy, but also copied or reproduced, so many bloggers at the bottom of the article will add copyright notice and links. Hope that some respect for the copyright of the Internet people can be reproduced in the time to leave a link and source. But if each article is manually added, then it will be very troublesome, and WordPress blog can be easily achieved automatically add copyright notice and links.
The original Liboseo is used directly in the article template in the article below to add the code, I use the WordPress official twentyten theme modified, so edit the theme of the loop-single.php, find the following code:
<div class = “entry-content”>
<? php the_content ();?>
<? php wp_link_pages (array (‘before’ => ‘<div class = “page-link”>’. __ (‘Pages:’, ‘twentyten’), ‘after’ => ‘</ div>’)) ;
</ div> <! – .entry-content ->
in
<? php the_content ();?>
Followed by the following code:
<copy> please specify from <a href=’http://www.cmsjzy.cn’> CMS concentration camp </a>, this article address: <a href=<?php the_permalink();;> ‘title = ‘<? php the_title ();?>’> <? php the_permalink ();?> </a>
Unless noted, CMS concentration camp articles are original, reproduced, please indicate the source and link! </ pre>
But out of the question, that is, if you install some wumii or Baidu share like plug-ins, then add the contents of the above can only be found in the absence of the following, rather than close to the article. Obviously this is not the effect we want.
After a variety of tests, and finally through the theme of the custom function to solve.
The method is very simple, because the reason we add the content can not be close to the article, because these plugins will be inserted into the contents of the_content (); function, and this function is WordPress program default function. If we modify the_content () function directly, then if you upgrade the WordPress program, it will be overwritten.
So I am through the theme of the functions.php file, in the bottom to add a custom function liboseo_content (), as follows:
function liboseo_content ($ more_link_text = null, $ stripteaser = 0) {
$ content = get_the_content ($ more_link_text, $ stripteaser);
$ content. = “<pre> reprint please specify from <a href=’http://www.cmsjzy.cn’> CMS concentration camp </a>,”;
$ content. = “URL: <a href='”.get_permalink($post, true).”‘ title='”.get_the_title($post_id).”‘>” .get_permalink ($ post, true). </a> “;
$ content. = “\ n unless noted, CMS concentration camp articles are original, reproduced please specify the source and link! </ pre>”;
$ content = apply_filters (‘the_content’, $ content);
$ content = str_replace (‘]]’, ‘]] & gt;’, $ content);
echo $ content;
And then the theme of the article template in the_content (); replaced with a custom function, such as my theme template file is loop-single.php, directly on the_content (); modified to liboseo_content (); into The
<div class = “entry-content”>
<? php liboseo_content ();?>
<? php wp_link_pages (array (‘before’ => ‘<div class = “page-link”>’. __ (‘Pages:’, ‘twentyten’), ‘after’ => ‘</ div>’)) ;
</ div> <! – .entry-content ->
To keep a look at it, is it a success? Before the change must be back up the original file, if possible, it is best to test the local good, and then modify the site.

WordPress blog batch delete all SPAM spam comments method

WordPress is a very popular mature free blog system. Now the network will produce a lot of spam every day (SPAM), many open the comments function WordPress blog every day can receive a large number of automatic submission by Bot, the water soldier for manual submission of spam comments. These spam comments are mainly based on the website link, which is a popular way to promote the network. These spam comments on the traffic big WordPress blog is a very helpless thing. There are some bloggers due to work for some time did not take care of the comments of the blog message, after a period of time back to find the blog was submitted a lot of SPAM spam comments.
We all know that in the WordPress management background can be selected in batches of 20 comments, and then delete or mark them as SPAM, but if there are thousands of pending comments this is not a way. What we need is a way to remove all spam comments in a way that can be a key, or more convenient. The study found a few can be more convenient to delete all the spam comments to be reviewed by the method to share with everyone.

Method One, use the WordPress plugin to remove all pending comments
We can download and install a Plugin plugin that can remove all Pending comments – Delete Pending Comments – WordPress plugin download address
After the installation of the wordpress background management comments (Comments) below you can see “Delete Pending Comments” (delete pending comments) link. Click on this link and will ask you to enter a word “I am sure I want to delete all pending comments and accessible this can not be undone” (I’m sure to delete all pending comments and know that deleted comments can not be restored) Make sure you want to delete all pending comments in bulk. Note that this is the comment that is pending review, not all comments, so the old comments will still be retained (including those that have been marked as SPAM spam comments will not be deleted).

Use the WordPress plugin to remove all pending comments
After typing this sentence, click the Delete Pending Comments button below to delete all pending comments in batches.

Method 2, use Akismet Smart Recognition to remove all spam comments
This method is more intelligent than the first method and is worth recommending. Akismet is a well-known anti-spam system on the WordPress blog system where blogs can use it to scan and remove all spam comments. Akismet is characterized by its ability to intelligently determine which comments are SPAM spam, which reviews are really written by people, and valuable blog comments (English station recognition rate is not higher). Akismet link address
To install Akismet first you need to get a WordPress API key. Click on the background after the installation is complete. Then you can see a check for the check for the Spam button at the Edit Comments section. Click this button, Akismet will automatically start scanning all the comments, and all the comments on the characteristics of spam comments classified as spam category. This is also the reason why this method is recommended, because Akismet will leave the real comment more intelligent than the first way to remove all pending comments.

Use Akismet Smart Recognition to remove all spam comments

Method 3, use phpMyAdmin into the MySql database to remove all spam comments
If you prefer to write a command, you can try this method. First login WordPress blog where the MySql database server, enter the WordPress database, through a SQL statement batch delete the database in addition to review all comments by commenting the record. Methods as below:
Log in WordPress where the MySql database, and then click on the right side of the SQL, copy and paste the following code into the large text box:
DELETE FROM wp_comments WHERE comment_approved = ‘0’
wp_comments is the comment where the data table name, if your table name needs to be changed to your table name, and then click the bottom right corner of the GO button. Use this method to remove all comments other than comments by review, including comments to be reviewed, marked as spam. Spam comments are useless, this can also effectively reduce the size of the database, played a clean up the purpose of the database.

Use phpMyAdmin to access the MySql database to remove all spam comments

Finally, sum up: the first method: all the comments to be reviewed are deleted, the old comments will be retained, but the real review of the same review was deleted. The second method, more intelligent, but the high recognition rate is not high I did not test (if you try to give feedback on the results to us). In the third, all the comments in the database that are not audited are deleted, leaving only the comments that were approved. Is not the world feel a lot of quiet?

WordPress theme to add google font

Google Web Fonts provide a secure and beautiful font service for your blog for free. By using Google Web Fonts, your blog does not have to upload any fonts to display fonts other than the usual “Arial”, “Verdana” fonts.
As we all know, website readability depends on its design and appearance. Web design plays the most important role in the font, the use of what kind of font is important to your site. For example, Arial / Helvetica (sans-serif), Verdana and Georgia are our commonly used web design fonts. These fonts provide a good readability, but if you want to use the new font, all you need to do is make sure that the viewer’s network device installs these fonts. This is difficult to determine. So you have to upload their own fonts to the server, and through CSS to be controlled. But now, there is a better free tool, that is, Google Web Fonts
Before you use the Google Web Fonts service, first understand the following two points:
Choosing too many fonts will slow down your blog loading speed, so you just have to choose what you have to use to avoid slowing down your visit.
If you can only choose the language you need, you will help prevent your page from becoming slow.
At present, the interface and preview language of Google Web Fonts are not English (without interfering with Chinese).
Google Web Fonts can visually display a variety of web fonts, like Serif, Sans-Serif, Display and Handwriting, you can also browse certain properties, such as script display font, width, tilt and thickness. All of these properties can be displayed in the side pane. When you choose the font you want, you can also intuitively preview the overall style such as words, sentences, paragraphs and so on.
Here is a simple tutorial to help you use Google Web Fonts faster and faster:
1. Click Google Web Fonts to enter the Google font service, select the font you want, and then click the “Add to collection” button in the lower right corner. Here we select the “Alike” font as an example font for the entire tutorial.

2. Click “Add to collection”, there will be a message at the bottom of the page “1 font family in your collection” and three buttons, “Choose”, “Review” and “Use.” Here we Select “Use”. That is to use.

3. It also requires setting the font. Select available styles, such as “bold, italic,” and so on. But only for certain specific fonts. Next, select the specific language character. Generate the code.

4. Next is the code department, Google fonts provide three application code, namely the standard mode “Standard (external stylesheet)”, export mode “@import method” and JS mode “JavaScript”. As needed, now you need the pattern, but here we recommend choosing the standard mode. Copy the code in step 3 and copy them to your theme header.php before </ head>.
5. Now add the font name to your theme’s css file. For example: You want to use google web Fonts in paragraph <p> as the default display font. css code directly write on the line:
p {
font-family: ‘Alike’, Arial;
}
This code will display the google font “Alike” in your blog paragraph, and if the font to be loaded encounters some temporary problems, it will appear as a “arial” font. Likewise, you can add a font style to other elements, such as “body” overall layout, links to “li” lists, and so on.

The WP-PostViews plug-in shows how to set the time for the popular article

Do not know for what reason, 1.30 after the WP-PostViews plugin canceled the original existence of the get_timespan_most_viewed function, which is also recently learned on the Internet, because recently have the mood to modify the theme, plug-in, find kid’s blog above this plugin provides small Tools in the sidebar display content is not how to change a few months, the reason is very simple, set up is the most browsing articles, more and more more and more, so I would like to modify the display settings, unfortunately the background is not related settings, although There is the nearest, but it seems that I am not the result.
Baidu for a while to know the original plug this function, and now there is no, but some people share the previous function on the Internet, so much simpler. Copy the following function to the wp-postviews.php file anywhere (of course, to the appropriate point of any place, do not put other functions in the middle ok).
function get_timespan_most_viewed ($ mode = ”, $ limit = 20, $ days = 1, $ display = true) {
global $ wpdb, $ post;
$ limit_date = current_time (‘timestamp’) – ($ days * 86400);
$ limit_date = date (“Y-m-d H: i: s”, $ limit_date);
$ where = ”;
$ temp = ”;
if (! empty ($ mode) && $ mode! = ‘both’) {
$ where = “post_type = ‘$ mode'”;
} else {
$ where = ‘1 = 1’;
}
$ most_viewed = $ wpdb-> get_results (“SELECT DISTINCT $ wpdb-> posts. *, (meta_value + 0) AS views FROM $ wpdb-> posts LEFT JOIN $ wpdb-> postmeta ON $ wpdb-> postmeta.post_id = $ “AND AND meta_keyword = ‘ideas’ AND post_password = ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ORDER BY views DESC LIMIT $ limit ‘);
if ($ most_viewed) {
foreach ($ most_viewed as $ post) {
$ post_title = get_the_title ();
$ post_views = intval ($ post-> views);
$ post_views = number_format ($ post_views);
$ temp. = “<li> <a href=\””.get_permalink().”\”> $ post_title </a> – $ post_views” .__ (‘views’, ‘wp-postviews’). < / li> “;
}
} else {
$ temp = ‘<li>’ .__ (‘N / A’, ‘wp-postviews’). ‘</ li>’. \ n “;
}
if ($ display) {
echo $ temp;
} else {
return $ temp;
}
}
Just put the above statement is still not work, although many blogs that can, may all think that write blog language? Although I can change, but the boy think that for those who do not understand why php novice, it is really harder and harder ah.
Here kid for everyone to sort out the next, for everyone to share.
case ‘least_viewed’:
get_least_viewed ($ mode, $ limit, $ chars);
break
Very simple, open the wp-postviews.php file in the ### Function: Display Least Viewed Page / Post or other functions above the above function, once again, the function to add location, but as far as possible with other business functions put together, Easy to analyze it! After the operation is the small tool options Statistics Type add get_timespan_most_viewed option, this directly in the wp-postviews.php file search Statistics Type, you can see
<$ php_e (‘Least Viewed’, ‘wp-postviews’);?> </ option>
Or the contents of other options, copy a line, paste to the top or below (of course, can also be the middle), and then the above statement least_viewed or other copy of the statement you change the value to get_timespan_most_viewed, so complete the background operation, But the current choice of this option is not displayed after the sidebar, because the output of the place to improve, the next step is also in the wp-postviews.php file operation, search class WP_Widget_PostViews, function widget function to find the switch statement, which should have Four turns, shaped like
case ‘least_viewed’:
get_least_viewed ($ mode, $ limit, $ chars);
break
Do not want to re-copy a copy of the location to the parallel, will least_viewed modified to get_timespan_most_viewed, so back to the first page refresh, the display should be a hot day, because the function is the default (the original function is the default 30 days, Set to 1 day), there is no option in the background, there is a need to modify the function of their own data can be.
In addition, the point is that the above provided get_timespan_most_viewed function is the old version of the function, does not support the current version of the output format, etc., where the kid and according to the new variable definition of the following functions, you can directly replace the above provided The get_timespan_most_viewed function is used, the function body is as follows
$ where = “post_type = ‘$ mode'”;
} else {
$ where = ‘1 = 1’;
}
$ most_viewed = $ wpdb-> get_results (“SELECT DISTINCT $ wpdb-> posts. *, (meta_value + 0) AS views FROM $ wpdb-> posts LEFT JOIN $ wpdb-> postmeta ON $ wpdb-> postmeta.post_id = $ “AND AND meta_keyword = ‘ideas’ AND post_password = ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ” ORDER BY views DESC LIMIT $ limit ‘);
if ($ most_viewed) {
foreach ($ most_viewed as $ post) {
$ post_views = intval ($ post-> views);
$ post_title = get_the_title ($ post);
if ($ chars> 0) {
$ post_title = snippet_text ($ post_title, $ chars);
}
$ post_excerpt = views_post_excerpt ($ post-> post_excerpt, $ post-> post_content, $ post-> post_password, $ chars);
$ temp = stripslashes ($ views_options [‘most_viewed_template’]);
$ temp = str_replace (“% VIEW_COUNT%”, number_format_i18n ($ post_views), $ temp);
$ temp = str_replace (“% POST_TITLE%”, $ post_title, $ temp);
$ temp = str_replace (“% POST_EXCERPT%”, $ post_excerpt, $ temp);
$ temp = str_replace (“% POST_CONTENT%”, $ post-> post_content, $ temp);
$ temp = str_replace (“% POST_URL%”, get_permalink ($ post), $ temp);
$ output. = $ temp;
}
} else {
$ output = ‘<li>’ .__ (‘N / A’, ‘wp-postviews’). ‘</ li>’. \ n “;
}
if ($ display) {
echo $ output;
} else {
return $ output;
}
}
}
As shown in the function parameters, set the number of days has been marked with the note, where is still no longer provide the option to set the panel, the need for friends can own toss, kid in the debugging time may be because the day visit is too low, set 1 day Can not achieve the desired display, set back to 30 days, we can set according to need.

WordPress comes with TinyMCE editor using the full version of the skills

Since the use of WordPress since I do not know how many background editing, from FCKEditor to CKeditor, and even some of the little-known CodeRenderUnmi and WLW, FE editor, etc., used to find some features really strong, but It is necessary to modify a lot of things with easy, and once WordPress or plug-in itself to upgrade their own, those who have to modify the things that must be re-set again, quite trouble; or some offline editor, copy to paste to Very bother. Up to now, I still feel that, wordpress template comes with the editor is the most powerful and practical!
Is the so-called “since the intensive, gradually in the absence of sword wins the sword of the territory,” put aside those exaggerated editor, back to WordPress comes with TinyMCE editor up, you know, WordPress itself is constantly strong, Every time the upgrade on the built-in editor changes are very practical, not only the integration of multimedia functions together, and gives the feeling is more and more neat, since we can see the official on the editor TinyMCE Attention to the degree. Now I will own the editor TinyMCE own way to paste out, all the code only need to write to the theme of the functions.php file, even if the future upgrade WordPress also do not need to repeat the operation.
Change the editor default view to HTML
As we all know, in the background of the new article, the editor will automatically jump to the “visual” view, for some often insert the code or WEB designers (I was ^ _ ^), may be more accustomed to using HTML view manually edit. Also, like CKEditor editing in the visual view has no <p> or <div> tag, but will automatically add to the HTML view, of course, this is CKEditor automatic settings nothing wrong, but in the future want to re-edit a published When the article will be a headache, because CKEditor will be self-contained to generate a lot of complicated or confusing code, keep the code clean and tidy is very inconvenient (of course, you want to make do with the actual display will not have a great change, but Will reduce the structure of the page).
Set the method: Add the following code to the theme’s functions.php file:
add_filter (‘wp_default_editor’, create_function (”, ‘return’ html “; ‘));
Add editor default content (visible in editor)
After the new article editor editor content is empty by default, some friends do is wordpress theme station, plug-in station or a simple download station, some standard formatted article will enter the “theme name”, “theme author” , “Download address” and other content, add the default content, the repetitive work later no longer, and everything is pre-defined. And if the article does not need to publish these pre-defined content, only need all-Delete ok, and will not be very troublesome.
To set the method: Add the following code to the subject functions.php file:
function insertPreContent ($ content) {
if (! is_feed () &&! is_home ()) {
$ content. = “<div class = ‘wpohome’>”;
$ content. = “<h4> CMS concentration camp </ h4>”;
$ content. = “The predefined content here is visible in the editor <a href=’http://www.cmsjzy.cn’> CMS concentration camp </a>”;
$ content. = “</ div>”;
}
return $ content;
}
add_filter (‘default_content’, ‘insertPreContent’);
Add editor default content (not visible when editing)
The content added by this method is automatically added at the end of the content when the article is published, invisible at the time of editing, used to add subscriptions, article copyright information, and so on.
To set the method: Add the following code to the subject functions.php file:
function insertFootNote ($ content) {
if (! is_feed () &&! is_home ()) {
$ content. = “<div class = ‘wpohome’>”;
$ content. = “<h4> CMS concentration camp </ h4>”;
$ content. = “The predefined content here is visible in the editor <a href=’http://www.cmsjzy.cn’> CMS concentration camp </a>”;
$ content. = “</ div>”;
}
return $ content;
}
add_filter (‘the_content’, ‘insertFootNote’);
Add more HTML tags (with caution)
This feature should be used with caution, because WordPress comes with the TinyMCE editor will filter out the default does not meet the XHTML 1.0 html tags, such as “br /”, “iframe” and so on. But do not rule out the case may also use these labels, so the method for the reference for you.
Add method: Paste the following code into the theme’s functions.php file:
function fb_change_mce_options ($ initArray) {
$ ext = ‘pre [id | name | class | style], iframe [align | longdesc |
name | width | height | frameborder | scrolling | marginheight |
margin? | src] ‘; // Note: The format is “label one [attribute one | attribute two], label two [attribute one | attribute two | attribute three]
if (isset ($ initArray [‘extended_valid_elements’])) {
$ initArray [‘extended_valid_elements’]. = ‘,’. $ ext;
} else {
$ initArray [‘extended_valid_elements’] = $ ext;
}
return $ initArray;
}
add_filter (‘tiny_mce_before_init’, ‘fb_change_mce_options’);

WordPress title title repeats is not conducive to SEO solution

In the use of Google administrator tools found when the wordpress blog list page repeat page 56, is certainly very detrimental to seo. We all know that wordpress paging calls the title tag in header.php, for which we can fix the problem by repeating the title of the title page on the title tab in the header.php on the title tag to join the paging page of the calling tag to tell the search engine this Is the two pages, and ultimately achieve the SEO effect.
Here, I mainly talk about the category, that is, the title of the catalog directory is repeated, other pages are similar.
Before we can add the page number, we can find this line of code in header.php:
<? php if (is_category ()) {?> <? php single_cat_title ();?> – <? bloginfo (‘name’);?> <? php}
At this point, if the category directory article goes beyond one page, we can see that all the category titles are duplicated, that is, “category directory title – blog title”, we can modify the following,
$ paged = get_query_var (‘paged’); if ($ paged> 1) printf ($ paged> 1) printf (‘paged’); ‘-% s page’, $ paged);?> <? Php}?>
This code means that the first page to obtain the number, if not the first page then add the page number, said the first few pages, through this method can effectively eliminate the page page repeat the title of the problem.
In order to achieve the classification of the title of the title “category directory title – blog title – page number”, in addition to the first page.
Similarly, if it is the home page, you can
($ paged> 1) printf (‘- the% s page’); </ p> </ p> </ p> </ p> </ p> <p> $ paged); <? php}?>
Other pages are also similar, just need to be
$ paged = get_query_var (‘paged’); if ($ paged> 1) printf (‘-% s page’, $ paged);
Add to the appropriate location can be.

WordPress will select the text forwarded to the microblogging method

Tencent news recently looked at, when inadvertently found that when I selected the news in the text, the upper right corner of the mouse will display a “broadcast to microblogging” button, click on the selected text will be forwarded to the microblogging The This is a very good user experience, if it can be introduced into the WordPress blog, it is not very good?
I also specifically to register a developer of Tencent microblogging open platform, when I began to read the development of the document, only to find his sister, Tencent official has launched a similar function of the application, called “Q-Share “, And then read some of the other information, the original has been written by the older generation of js page text selected to share Sina microblogging method, then I more effort, the combination of the two, the microblogging and Tencent microblogging two A button are added, and then the pain of the egg I put it translated into a jQuery method.
Effect, then you can see the site, and select any text, it will show two microblogging button in the upper right corner, click to try it.
Implementation of the method is also very simple, only two steps:
1, the introduction of jQuery, I believe most of the WordPress blog has been introduced jQuery, it can be a direct second step.
2, at the bottom of the page, or more precisely, in the introduction of the jQuery library behind the addition of such a JS, you can see the same effect and the site.
var miniBlogShare = function () {
// Specify the location in the node
$ (‘<img id = “imgSinaShare” class = “img_share” title = “will be selected content to share Sina microblogging” src = “http://www.cmsjzy.cn /2012/0203/1328255868614.gif” /> <img id = “imgQqShare” class = “img_share” title = “will be selected content to share to Tencent microblogging” src = “http://www.cmsjzy.cn /2012/0203/1328255868314.png” /> ‘). appendTo (‘body’);

// default style
$ (‘. img_share’). css ({
display: ‘none’,
position: ‘absolute’,
cursor: ‘pointer’
});

// Select the text
var funGetSelectTxt = function () {
var txt = ”;
if (document.selection) {
txt = document.selection.createRange (). text;
} else {
txt = document.getSelection ();
}
return txt.toString ();
};

// Select the microblog icon after selecting the text
$ (‘html, body’). mouseup (function (e) {
if (e.target.id == ‘imgSinaShare’ || e.target.id == ‘imgQqShare’) {
return
}
e = e || window.event;
var txt = funGetSelectTxt (),
sh = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0,
left = (e.clientX – 40 <0)? e.clientX + 20: e.clientX – 40,
top = (e.clientY – 40 <0)? e.clientY + sh + 20: e.clientY + sh – 40;
if (txt) {
$ (‘# imgSinaShare’). css ({
display: ‘inline’,
left: left,
top: top
});
$ (‘# imgQqShare’). css ({
display: ‘inline’,
left: left + 30,
top: top
});
} else {
$ (‘# imgSinaShare’). css (‘display’, ‘none’);
$ (‘# imgQqShare’). css (‘display’, ‘none’);
}
});

// click Sina Weibo
$ (‘# imgSinaShare’). click (function () {
var txt = funGetSelectTxt (), title = $ (‘title’). html ();
if (txt) {
window.open (‘http://v.t.sina.com.cn/share/share.php?title=’ + txt + ‘- reprinted from:’ + title + ‘& url =’ + window.location.href);
}
});

// click on Tencent microblogging
$ (‘# imgQqShare’). click (function () {
var txt = funGetSelectTxt (), title = $ (‘title’). html ();
if (txt) {
window.open (‘http://vtqq.com/share/share.php?title=’ + encodeURIComponent (txt + ‘- reprinted from:’ + title) + ‘& url =’ + window.location.href) ;
}
});
} ();
Note: This method is not only applicable to WordPress, JS is common, you can mount this JS to any website can get the same effect.

WordPress search engine crawling record code

Write a blog for some time, why the search engine is not included in your page? Want to know what spiders are “visiting” your site every day? As a wordpress user, it is necessary to know what spiders crawl every day to your website in order to understand the search engine spider crawling frequency, the site for targeted SEO optimization.
In fact, very simple, just add the following code, and then call the document code on the OK, is not it convenient? Let’s get started.
Before I also looked for a few spider crawling tools PHP version, the results are unsatisfactory. And most of these PHP programs to be installed, but also to add the spider crawl records to MYSQL, too much trouble. Then look for a simple spider crawler
1. First, create a robots.php file in the wordpress theme root and write the following:
<? php
function get_naps_bot ()
{
$ useragent = strtolower ($ _ SERVER [‘HTTP_USER_AGENT’]);
if (strpos ($ useragent, ‘googlebot’)! == false) {
return ‘Googlebot’;
}
if (strpos ($ useragent, ‘msnbot’)! == false) {
return ‘MSNbot’;
}
if (strpos ($ useragent, ‘slurp’)! == false) {
return ‘Yahoobot’;
}
if (strpos ($ useragent, ‘baiduspider’)! == false) {
return ‘Baiduspider’;
}
if (strpos ($ useragent, ‘sohu-search’)! == false) {
return ‘Sohubot’;
}
if (strpos ($ useragent, ‘lycos’)! == false) {
return ‘Lycos’;
}
if (strpos ($ useragent, ‘robozilla’)! == false) {
return ‘Robozilla’;
}
return false
}
function nowtime () {
$ date = gmdate (“Y-n-j H: i: s”, time () + 8 * 3600);
return $ date;
}
$ searchbot = get_naps_bot ();
if ($ searchbot) {
$ tlc_thispage = addslashes ($ _ SERVER [‘HTTP_USER_AGENT’]);
$ url = $ _ SERVER [‘HTTP_REFERER’];
$ file = “robotslogs.txt”;
$ time = nowtime ();
$ data = fopen ($ file, “a”);
fwrite ($ data, “Time: $ time robot: $ searchbot URL: $ tlc_thispagen”);
fclose ($ data);
}
?>
Upload it in your theme directory.
2. In the appropriate location of Footer.php or header.php add the following code to call robots.php.
<? php include (‘robots.php’)?>
Program principle: through the spider identifier (such as Baiduspider, Googlebot) to judge, record the spider creep time, and generate the log file robotslogs.txt in the root directory.
Program Disadvantages: can not record the spider crawling the page, the function is relatively simple.

WordPress comments add input mailbox instantly display Gravatar avatar function

Gravatar is an abbreviation for Globally Recognized Avatar, a service launched by gravatar, meaning “Global Universal Avatar” (already wall). If you put your own avatar on Gravatar’s server, then in any message that supports Gravatar’s blog or message, just provide the email address associated with this avatar to show your Gravatar header.
New theme with this feature, it is not difficult to achieve, so posted to share under
1. Add the following code to the functions.php file and add the default avatar to the comment box.
add_filter (‘comment_form_top’, ‘show_gravatar’);
function show_gravatar () {
global $ current_user;
get_currentuserinfo ();
echo is_avatar ($ current_user-> user_email, 40); // 40 is the size of the avatar, step 4 is the same
}
2. Set the position of the avatar with CSS, which is fixed in the upper right corner.
#commentform {position: relative}
#commentform .avatar {position: absolute; top: 0; right: 20px}
3. Download http://pajhome.org.uk/crypt/md5/2.2/md5-min.js, save to the theme folder.
4. Rename the file just to gravatar.js, add the following code at the end of this file:
if (document.getElementById (“email”)) {
document.getElementById (“email”). onblur = function () {
if (/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\a-a- zA-Z0-9_-]{2,3} ) {1,2}) $ /. Test (this.value)) document.getElementById (“commentform”). GetElementsByTagName (“img”) [0] .src = “http://www.gravatar.com/avatar / “+ Hex_md5 (this.value) +”? D = mm & s = 40 “;
};
};
If you find the email input box, when the cursor focus out of the email input box, with the regular test input is the email format, if it is inserted before the picture address to the newly generated address.
5. Open footer.php, add the following code:
<? php if (is_singular () && comments_open ()) {?> // Judgment is not a separate post page and comments open
<script type = “text / javascript” src = “<? php bloginfo (‘template_url’);?> / js / gravatar.js”> </ script>
<? php}?>
Simple 5 steps, instant display Gravatar function on the complete realization.

WordPress pictures to prevent hacking links

Method 1: modify the host root directory. Htaccess file
The general WordPress blog is using the Linux host, so you can enter the root directory through FTP, find. Htaccess file. In which to join
RewriteEngine onRewriteCond% {HTTP_REFERER}! ^ $ [NC] RewriteCond% {HTTP_REFERER}! Www.cmsjzy.cn [NC] RewriteRule. (Png | jpg) $ /nophoto.png [R, NC, L]
If you want some other sites to be able to use your pictures, you can be in
RewriteCond% {HTTP_REFERER}! Www.cmsjzy.cn [NC]
Followed by:
RewriteCond% {HTTP_REFERER}! You need to be able to display the URL [NC]
Are generally added FEED subscription URL, Baidu, Google or something. The last sentence of the nophoto.png file is to replace the stolen chain of pictures, it is recommended that the picture the smaller the better, you can get a big red fork, write refused to chain. Tips: not recommended at the same time prohibit gif | jpg | png these three picture files, such as you have banned the png, but with nophoto.png to replace the chain of pictures, this will certainly be a problem. If you want to disable both types at the same time, you can use the following sentence to replace:
RewriteRule. (Gif | png | jpg) $ image absolute address (need to add http: //) [R, NC, L]
OK, using .htaccess file for picture anti-theft chain has been completed. The same can not only picture anti-theft chain, add the file extension name, you can other files on the anti-theft chain settings.

Method 2: Use the WordPress Hotlink protection plugin plugin
Download WordPress Hotlink protection plugin plugin, install the plug-in, you can enter the plug-in settings page.
You can set the background in the plug-in to protect the image of the path, such as wp-content / uploads, if the change under the path of the picture was stolen chain, hacking the page will use the right warning picture to replace the original picture, of course, the warning The map can also be set in the plug-in background.

Method three: windows host background settings
If you are a Windows host, you can log in directly to the host background, set the picture anti-theft chain, because there is no windows-host Zhou Liang, so it is not demonstrated.

Method four: through the cPanel panel to set up anti-theft chain.
If you are using a Linux host that is a cPanel panel, you can set it in the CP panel.
1, after landing cPanel, click Security -> HotLink protection. This feature is to protect other sites directly link to your site on the file, through the settings can play the role of anti-theft chain.
2, the default may be disabled, you need to click the “Enable” button to enable it.
3, then the HotLink protection configuration, which “allow access to the URL” here generally fill in your own site URL, that is, what sites you want to quote your image address.
4, “to prevent direct access to the following extensions” fill in your website using the image extension, separated by a comma, such as: jpg, jpeg, gif, png, bmp.
5, “Url re-directed to” You can set a copy of your own copyright picture, when someone illegally references your picture will be the default display of this picture to warn him. Directly enter the address of the picture can be.
6, the above settings are completed, the last click on the “submit” can, then you can own other sites on the site under the reference to the picture test, look at the results.

Method 5: Add a watermark to the picture
This method, many of my friends are using, but still have a lot of children’s shoes and even add the watermark pictures will be chained.

Method 6: simply not in the wordpress blog host inside the picture
The amount of the most Niubi a method, not directly inside the blog to join the picture, or use the picture outside the chain. But this time on the subject, and I was a small joke to open, hehe!

WordPress through ajax way to obtain sidebar information

1, first have to load jquery library;
2, in their own to write the js file to write:
function ajaxs () {
$ .ajax ({
url: ‘http://127.0.0.1/?action=ajax’, // domain name replaced with what you want to use
type: ‘get’,
beforeSend: function () {
var loading = ‘<span class = “loadsidebar”> </ span>’;
$ (‘# hotposts’). empty (). html (loading) / / loading loading ah God horse
},
error: function (a) {
$ (“# hotposts”). hide (). empty (). html (‘<div style = “text-align: center; padding-top: 20px; fadeIn (‘fast’)
}, // error when the output of God horse
success: function (a) {
$ (‘# hotposts’). empty (). html (a) // output when the god horse
}
});
return false
};
ajaxs ();
3, in the function.php file to write:
function AjaxLoad () {
if (isset ($ _ GET [‘action’])) {
if ($ _ GET [‘action’] == ‘ajax’) {
echo ‘Oh shit’; / / You can output according to need, such as the output of the latest comments, the latest article, the latest sister what
die;
}
// if ($ _ GET [‘action’] == ‘ajax’) {
/ / If you understand, then this code can also write a number of right?
}
}
add_action (‘init’, ‘AjaxLoad’);
Done successfully.
With the above template, basically the functions to be used can be completed, such as the mouse across: $ (‘# xxx’). Hover (function () {…}, such as click somewhere: $ ( ‘#ooo’). click (function () {…}. Put the last sentence in the js section to the inside to complete the bird. Specifically see the ink theme of the sidebar newcomments and Active Friends part of the effect.

WordPress 3.3 Background function failure solution

With the release of the official version of WordPress 3.3, many of the fans are the first time to upgrade the program to the latest version, but soon found that some of the “background” features of the theme (including HotNews theme) set the background before the failure.
WordPress as early as 2.8 version to increase the custom background body_class () function, until the 3.0 version of the default theme has been added in the “background” function, with this feature is not a lot of themes, most of the theme designers may feel this feature There is no need to increase the database query, but the body_class () function of the original intention, not to simply replace the entire site of all the pages of the background, but to facilitate the flexibility of the design staff control Different pages of the elements of the style, the truth is not to say, the following talk about the specific solution:
Program a WordPress version 3.3 in the program wp-includes directory theme.php add a custom-background label, which is caused by the “background” function failure problem, open the theme.php program file, found in line 1797:
body.custom-background {<? php echo trim ($ style);?>}
Delete one of the .custom-background changes to:
body {<? php echo trim ($ style);?>}
This method is suitable for all previous support “background” feature of the theme, but need to modify the program file, I do not recommend using.
Option 2 This is the standard solution to the problem, open the default theme Twenty Eleven the header.php template, you will find one sentence:
<body <? php body_class ();
Instead of the normal <body> tag, which is the key, replace the above code with the body of the header.php template <body> tag you can use.
Three programs
<body class = “custom-background”>
Replace the header.php template <body> tag, do not let it add extra tags, this method is convenient and practical, suitable for all themes.

WordPress commonly used functions

1.bloginfo ()
As the name implies, the function is mainly used to display the blog information; and according to the different parameters, can be used to display the different parts of the blog information. Commonly used are the following:
bloginfo (‘name’) shows the blog title, such as “site”; default (do not write parameters) output the item;
bloginfo (‘description’) shows the blog description part, such as “the road is far from its repair Xi, I will be up and down and quest”;
bloginfo (‘url’) output blog URL address, such as http://www.cmsjzy.cn;
bloginfo (‘rss2_url’) shows the blog’s RSS2.0 feed address, such as http://www.cmsjzy.cn/feed;
bloginfo (‘template_url’) is used to get the template address of the WordPress blog;
bloginfo (‘charset’) shows how the blog is encoded, such as “UTF-8”;
A common combination of using the bloginfo () function is as follows:
“Title =” “>
This form is usually used to add the bottom of the blog information, such as Copyright @ site, often used in the theme template.
Note that the bloginfo () function can only output these parameters. If you want to use these values ​​in a PHP statement, you need to use the get_bloginfo () function, which uses the same parameters as bloginfo () to get the same result.

2.wp_title ()
The function is used to display the title of the page, as in the article page, the article title is displayed; on the category page, the category name is displayed;
wp_title () function can be followed by three parameters, namely wp_title (‘separator’, echo, seplocation), where separator is the division between the title and the rest of the symbol, the default is >>; echo is a bool variable, False to return the title as a PHP parameter; seplocation defines the location of the delimiter, and right defines the delimiter after the title, whichever is any value, and indicates that the delimiter is placed before the title.

3.wp_get_archives ()
This function is used to get the blog’s article archive, and by setting the parameters of the function, you can get it in various ways, such as month, year, and so on.
The wp_get_archives () function can also be followed by a variety of arguments, except that all parameters need to be treated with a & link and placed in a single quotation mark (‘) as a string, as in wp_get_archives (‘ type = monthly & format = html & show_post_count = 1 & limit = 10 ‘).
The above parameters are described as follows:
type = monthly means to display article archives on a monthly basis, you can use yearly, daily, weekly, etc. instead of monthly that year, day, and week show article archive;
# format = html means to use the usual HTML formatted article list;
show_post_count = 1 means that the number of articles belonging to the category (year, month, etc.) is displayed after the article archive, which is a bool value;
limit = 10 means that the maximum number of articles archived is 10, the number of times exceeded, then the part is not displayed;
Although the parameters slightly more, it is slightly complicated, but in fact only pay attention to type, show_post_count and limit three parameters can be.

4.wp_list_categories ()
Similar to the wp_get_archives () function, the wp_list_categories () function is used to get the classification information for a blog post and can be displayed by setting the appropriate function parameters. The parameters of the function and wp_get_archives () function similar to the need to use & link, put in single quotation marks (‘) to pass the string. Form like wp_get_archives (‘orderby = name & order = ASC & show_count = 1 & use_desc_for_title = 1 & feed = subscribe & exclude = 2,5 & number = 10’).
In the example above, the meaning of the function parameters is as follows:
orderby = name that according to the name of the alphabetical order of classification information, you can change the name ID;
order = ASC indicates that the classification information is displayed in ascending order of the alphabetical name of the category name, and ASC is changed to DESC in descending order;
show_count = 1 The number of articles belonging to the category is displayed after each category name;
use_desc_for_title = 1 Use the description of the category to add a title attribute for each category name hyperlink;
feed = Subscription: Add a hyperlink named “Subscription” next to each category to provide the RSS feed for that category;
exlude = 2,5: in the display of the classification to remove the ID 2 and 5 of the classification; can also use include = 2,5 that only show the ID of 2 and 5 classification;
number = 10: Indicates that only the first 10 categories are displayed.

5.get_the_category ()
The get_the_category () function is used to return an array of properties of the category to which the current article belongs, which includes the following:
cat_ID: ID of the current category (can also be written as ‘term_id’);
cat_name: the name of the current category (also written as ‘name’);
category_description: description of the current classification (can also be written as ‘description’);
category_count: The number of articles that belong to the current category (also written as ‘count’).
The specific use of the method, we through the following several sentences to illustrate:
A statement such as get_the_category () -> cat_ID, returns the ID number of the category to which the current article belongs;
Such as get_the_category () -> description of the statement, return to the current article belongs to the description of classification;

6.the_category ()
This function returns the name of the category to which the current article belongs, and is a hyperlink to the article category.
The default no parameter form the_category () directly displays the category name as a hyperlink, as:
You can format the output, such as the_category (‘-‘), if the current article belongs to more than two categories, you can display such a form: It is displayed in such a form: fine promotion.

7.category_description ()
This function takes the classified ID as input and gets the description of the classification. And often echo, get_the_category () with the use of the current classification description output:
echo category_description (get_the_category () -> cat_ID);
Get_the_category () get an array of the current classification information; cat_ID is the ID of the class in the array; enter the ID into the category_description () function to get the description of the class; then use echo to output it The
But by the site test, the use of the following statement can achieve the same function and the above statement:
echo category_description ();
This may be because the function outputs the result of the current classification description in the case of default no parameter input.

8.is_home ()
is_home () to determine whether the currently displayed blog page is the blog home page and return a Bool value. Returns TRUE if it is on the home page; otherwise returns FALSE.
This function is often used to control the way the blog sidebar is displayed, often using the following code snippet:

9.is_archive ()
is_archive () to determine whether the currently displayed content is a blog archive page, such as a date archive, or by archive, and so on; it returns a Bool value just like the is_home () function.

10.is_page ()
The is_page () function determines whether the currently displayed content is a separate page of the blog, such as “WordPress”, “About this site”; it also returns a Bool value.
We can in the template through the function to determine whether the current is a separate page to determine whether the current display of the article shows the release time and so on.

11.is_paged ()
This function is used to determine whether the current article is tabulated because of too much content. Note that the function does not return TRUE if you have manually added a label to force paging when writing an article.

12.is_page_template ()
The is_page_template () function takes a parameter, usually in the following way:
is_page_template (‘guestbook.php’);
To determine whether the current display of the independent page (page) using the parameters shown in the template guestbook.php; if not with the parameters, the function returns the current independent page whether the use of the template.

13.is_single ()
is_single () to determine whether the currently displayed page content is a separate article. One can be followed by three parameters, one is the article ID; one is the article title (title); one is the article name (slug, article title of a short description of the form); or can be used in combination of three parameters, To determine whether the current page content is a specific article.
A simple example is as follows, we can through the following ways to determine whether the current display is the text:
is_single (‘808’); is_single (‘use-wordpress-second’); is_single (‘808’); is_single (‘ Do not know the function (b) ‘,’ functions-must-known-using-wordpress-second ‘);
Here, the site needs to do the last one of the above description: the function followed by three parameters, there is a priority, if the first parameter meets the conditions, then return TRUE; otherwise, return FALSE; looks like the following parameters And it does not make sense.

14.is_category ()
The function is used to determine whether the currently displayed page content is a sorted page, such as site-related; where no parameters are required. The function returns a Bool value.

15.is_tag ()
is_tag () to determine whether the currently displayed page is a tab page, such as WordPress; then do not need to follow the parameters. The function also returns a Bool value.

16.is_date ()
This function is used to determine whether the currently displayed content is a time-archived page, such as April 2009, or April 8, 2009, and so on.

17.is_day (), is_month (), is_year ()
These functions are used to determine whether the currently displayed content is a page by day, month, and yearly. They are similar to is_date (), but will only archive the time more specific.

18.is_author ()
This function is used to determine whether the currently displayed content is a page with the author’s name, such as the admin author page of the site.

19.is_admin ()
The is_admin () function is used to determine whether the current is on the control panel page, or the admin panel page.

20.get_bloginfo ()
This function and our previous article use WordPress do not know the function (a) described in the bloginfo () function to achieve almost the same function. Mainly used to display the information of the blog; and according to the different parameters, will output different information of the blog.
Followed by the parameters, get_bloginfo () can display the blog name, shaped like “this site”;
Followed by other parameters, you can display the corresponding information, such as get_bloginfo (‘description’) to display the blog description information;
Other parameters that can be used include name, url, wpurl, and admin_email. But because it is with the bloginfo () function to achieve the same results, so in the case of bloginfo can be achieved, this site is not recommended to use get_bloginfo () function.

21.query_posts ()
The query_posts () function takes the appropriate parameters to control which articles are displayed on the page.
Such as query_posts (“cat = 3,6 & cat = -5, -10”) that take the classification of the ID of 3 and 6 of the article shows no classification ID of 5 and 10 of the article show;
The meaning is as follows: query_posts (“order = ASC & showposts = 10 & offset = 1 & orderby = date & posts_per_page = 5”)
order = ASC in ascending order, DESC is in descending order;
showposts = 10 means to get 10 articles;
offset = 1 means the latest article;
orderby = date means that the article is sorted by date;
posts_per_page = 5 means 5 articles per page.
It should be noted that the function is only the contents of the article from the MySQL database query out, to display it, but also need to cooperate with other statements, such as a frequently used in the sidebar as follows:
The above code is used to display the latest five articles at the specified location on the sidebar.
query_posts () function can be followed by a variety of types of parameters, the function is very powerful, in this, we do not introduce too much. If time and energy allow, this site will be written in a later article specifically for friends to make an introduction.

22.get_posts ()
The function and query_posts () function is roughly the same, are used to query from the database and get a condition in line with the article. However, the use of the get_posts () function has a fixed form, as follows:
“Id =” post – “>
First, use the get_posts () function to get the article data, and then use the form like foreach ($ lastposts as $ post): setup_postdata ($ post); The loop will query the contents of the article displayed.
The get_posts () function uses the same parameters as the query_posts () function, and we will not go into detail here.

23.wp_list_cats ()
This function has the same functionality as the wp_list_categories () function in WordPress. However, in the latest version of WordPress, this function has been deprecated and its function is completely replaced by the wp_list_categories () function.

24.get_calendar ()
The get_calendar () function is used to display the calendar on WordPress, the calendar style is the same as using the widget, as shown in the following figure:
Which can then be followed by a BOOL parameter to control the display style of the week above the calendar. But by the site test, in the Chinese state, the use of TRUE or FALSE parameters, the calendar display is no different.

25.wp_list_bookmarks ()
This function is used to display the blog’s links and can use various parameters to control the number, type, and style of the display.
Form, such as wp_list_bookmarks (‘title_li = & categorize = 0 & orderby = rand & include = 41,40,37,54’); form, meaning explained as follows:
title_li = & categorize = 0 is a commonly used combination, does not show WordPress background control panel set in the link title, but all the chain are displayed in accordance with the classification of the show; a separate title_li = can also be used to set The name of the category showing the chain;
orderby = rand set the chain display in a random order, of course, can also be set to other ways, such as id, url, name and so on;
include = 41,40,37,54 only show the ID of the four numbers of the four friends; Corresponding to this, also supports the use of exclude, said the number of friends do not show the number of links.
# In addition, the function often used parameters before and after, used to set each link before and after the text, the default is and
mark.

26.get_links (), wp_get_links ()
These two functions implement the same functionality as 25.wp_list_bookmarks (), but these two functions have been replaced by 25.wp_list_bookmarks () during the WordPress upgrade.

27.wp_list_pages ()
The function displays all pages within the WordPress blog as a hyperlink to the page name, often used to create a top navigation page or to decorate the sidebar.
The function is called wp_list_pages (‘title_li = & sort_column = menu_order & include = 12,25,38,57 & depth = 1 &’); The meaning of each parameter is as follows:
title_li = used to set all the display page of a total name; no parameter value behind, that does not display the name;
sort_column = menu_order used to set the order of the page display, said in accordance with the WP background settings of the page order display, the other commonly used sequence settings may also include post_title, post_date, ID, etc.;
include = 12,25,38,57 that only show the four values ​​for the four pages; Similarly, you can use exclude to exclude the corresponding ID of the page;
depth = 1 indicates that only the parent page is displayed, and all subpages are not displayed; other values ​​include the default 0, indicating that all pages (pages are indented); – 1 shows all pages (pages are not indented); and many more.
In addition, the properties that may be used by the function include link_before and link_after, which are used to set the characters before and after the displayed page link.

28.wp_tag_cloud ()
As the name suggests, the wp_tag_cloud () function is used to display the WordPress blog’s tag cloud.
A function called wp_tag_cloud (‘smallest = 8 & largest = 22 & number = 30 & orderby = count’); the meaning of each parameter is as follows:
smallest = 8 is used to set the label size of all the labels displayed in the tag cloud with a minimum count (at least article).
largest = 22 The label size for all tags that are used to set the tag cloud to the most (most used articles) is 22;
number = 30 sets the maximum number of tags displayed in the tag cloud to 30;
orderby = count Sets the sorting of tags in the tag cloud to the count (default), not the name (the default is name, the default when the widget is called).
Other commonly used parameters include include and exclude, used to set whether the tag cloud contains or remove the ID as a number of labels.

29.wp_register ()
The wp_register () function is used to display the “site management” hyperlink to the administrator; or when the WP blog is open, the “registered” hyperlink is displayed to the unregistered user.
The function does not require any parameters, the only possible use of the parameters such as wp_register (‘front’, ‘after’), you can display the hyperlink text before and after the show a “front” and a “post” word. Of course, you can use this imagination to personalize your site’s management or registration links.

30.wp_loginout ()
This function is used to display a “login” link at the specified location; of course, if you have already logged in, an “exit” link will be displayed accordingly. This function does not use any parameters later, so flexible customization is not possible.
However, if you want to customize your own WP blog login or exit the link text, you can still use the following 31 described in the function wp_logout_url () and wp_login_url ().

31.wp_logout_url (), wp_login_url ()
Using the function as above 30, although you can easily set up login for the WP blog, exit the link, but the custom is not flexible enough. So, starting with the WordPress version 2.7, there are two functions available here. They are used to get WP blog exit or login hyperlinks, and then we use the hyperlink can be prepared to write the following code to the WP blog login and exit links for flexible settings:
“Click here to exit
“Click here to log in
Of course, in order to achieve the perfect effect, but also need to judge the visitor’s login status, use an if statement, according to the login status display the corresponding menu item.

32.wp_meta ()
The function is usually followed by the function in the back of 29,30, the specific visual display on what is not the same, it seems WP theme for the WP plug-in left API Hook, the site suggested that friends in the function above to keep up with this A function.

33.get_recent_posts ()
This function is only available when you have installed the Chinese WordPress toolbox. Its role is used to obtain the latest log, the function prototype is as follows:
# get_recent_posts ($ no_posts = 5, $ before = ‘+’, $ after = ‘
‘, $ Show_pass_post = false, $ skip_posts = 0)
You can use the $ no_posts control to show the number of articles, $ before and $ after the meaning and the same function in the previous; As for the latter two parameters, generally do not have to set the direct value can be taken directly.
However, because the function and WordPress built-in get_posts () and query_posts () function function is repeated, so usually rarely used.

34.get_recent_comments ()
In fact, after installing the above WordPress toolbox, the most commonly used is this function, because the WordPress program itself does not have built-in access to the latest comments function. The prototype of the function is as follows:
# get_recent_comments ($ no_comments = 5, $ before = ”, $ after = ‘
‘, $ Show_pass_post = false)
Meaning Obviously, and the above function is similar to this site no longer speak.

35.get_recentcomments ()
This function is a function that is available after the WP-RecentComments plug-in is installed, similar to the function in 34 above.
The prototype of the function is as follows:
get_recentcomments (int num, int size)

36.wp_get_post_tags ()
The function is used to get the article’s tag on an article page or based on the ID of an article, and the result is placed in a tag array. A common use is as follows:
($ tags- $). $ “[$ keywords = $ keywords. } echo $ keywords;}
($ Post-> ID) to get the current article’s tag, and then get its name ($ tag-> name), and its combination of output.

37.single_cat_title (), single_tag_title ()
As the name suggests, these two functions are used to get the title page and tag page title, its usual use such as:
However, in addition, single_cat_title () can also be used to get the title of the current page on the tag page; but single_tag_title () is not available to get the title of the sort page.

38.get_settings (), get_option ()
The two functions and the previous use of WordPress do not know the function (c) function 20.get_bloginfo () similar to the use of the same method, you can follow the various parameters to get WordPress blog related information.
Such as the following call:
get_settings (‘name’) or get_option (‘name’)
Can be used to get the title of the current WordPress blog.

39.wp_head ()
This function is the same as the previous 32.wp_meta (), which is the API Hook left by the WP theme for the WP plugin.

40.get_header (), get_footer (), get_sidebar (), and comments_template ()
These functions are used to get and include the corresponding files in the WordPress theme. such as:
get_header () is used to include the header.php under the current theme folder;
get_footer () is used to include the footer.php under the theme folder;
get_sidebar () is used to contain the sidebar.php under the theme folder;
comments_template () is used to include comments.php.
It should be noted that if the current theme folder is missing the corresponding file, the function will use the wp-content / themes / default / folder under the corresponding file instead.
In addition, the above function can not follow the parameters, only get_sidebar () exception, because a theme can use multiple sidebar. A call method such as get_sidebar (‘up’) can include the sidebar-up.php sidebar template file in the theme.
In addition to the above functions, in the subject if you want to include a specific file, you can also use the following way:
include (TEMPLATEPATH. ‘/***.php’)
The above function can be included in the current theme folder named ***. Php file; where TEMPLATEPATH is a reference to the current theme folder address (not including the end / so it needs to be added).

41.have_posts (), the_post ()
These two functions are used in a limited range and are typically used in WordPress loops to get all the articles. The fixed form of use is as follows:
The article here shows the information when the article is not found, such as 404
Another common form is to combine the first two lines in the above code (other places are the same):
This form is usually used in templates such as index.php, archive.php, or single.php. In addition to other places, we usually do not see the two functions of the figure.

42.the_title (), the_title_attribute ()
the_title () function is mainly used to get the title of the current article, then you can keep up with three parameters (all omitted, take the default value), call the form as follows:
The parameter before is used to set the character content displayed in front of the obtained title; after is used to set the content that the title is displayed later; and display is a Bool value that controls whether the obtained title is displayed.
The_title_attribute () function is similar to the_title (), which is used as follows:
the_title_attribute (‘before = front & after = post & echo = true’)
Where before = and after = are used to set the title before and after the characters; echo = true or false user to set the title string is displayed.
The call form of the form or the_title_attribute (‘before = current article & after = comments: echo = true’) will show the following result:
The current article with WordPress do not know the function of the comments:

43.single_post_title (), single_tag_title (), single_cat_title ()

44.the_ID ()
The function does not follow any of the following arguments, using the following call:
Used to get and display the ID number of the current article page. However, the need to pay special attention to is that the function can only be used in the WordPress large cycle, the use of other places may also show the ID number, but the contents of the display will never change with the article.
In addition, the function is usually used in the CSS structure shown below:
You can set different title styles for different authors in your blog to distinguish.

45.get_the_ID ()
The function and 44.the_ID () function to achieve exactly the same function, the current WordPress official did not provide the use of the function. You can refer to the above description of the_id () function in 44 above. In particular, the function is similar to the_ID (), and it can only be used correctly in WordPress loops.

46.the_time (), get_the_time ()
the_time () is used to get and display the current article published time, and the above several functions similar to this function can only be used in WordPress large cycle.
The function can be followed by the control date or time format parameters, commonly used parameters as follows:
Such as the call form of the display: June 13, 2009 (English status shown June 13, 2009);
Such as the call form shows the effect: 7: 09 pm (English state shows 7:09 pm);
Such as the call form shows the effect: 19: 09.
In fact, in addition to using the_time () function, WordPress also provides a similar function get_the_time () function. The function does not have the display function of the_time () function, the rest of the function is exactly the same. When you use the get_the_time () function, you need to use a special statement to display the acquired time.
Here, we take this opportunity to simply understand the format of WordPress in time. In WordPress, usually used to control the time format of the characters: l, F, j, S, Y, G, g, i, a, etc., its detailed meaning is as follows:
l (lowercase L) is used to display the name of each day of the week, such as Saturday, or in English show Saturday;
F is used to display the month name, such as June, or June;
j is used to show one day of the month, such as 13;
Y is used to display the year in 4 digits, y is displayed in the last two digits, such as 2009 or 09;
G, g, i, a and other four characters are usually used in combination, as in the previous example, there are two forms:
g: i a shows the time in the form of a form such as 7:09 pm or 7:09 pm;
G: i displays the time in the form of a 24-hour scale, such as 19:09.
S is usually followed by j, indicating whether or not to add the English suffix (st, nd, th, etc.) after one day of the month.