This article mainly introduces the PHP code instance for adding page number navigation to the WordPress topic, which is also an essential basic function for creating various WordPress Themes, if you want to use WordPress, you can refer to WordPress's default recommendation for Topic developers to provide the top and bo
provides three ways to invoke it:
1. When the function is called in the main loop and no arguments are supplied, the number of articles in the first category is returned:
The code is as follows
Copy Code
2, the supplied parameter is a number, and the number is the ID number o
This article mainly introduces to the WordPress in the message plus the floor number of the PHP code example, here only for the main comment and not for the cascading building in the comments. We hope to help you.
Recently suddenly found a blog comment floor a bit of a problem, has been set to "show a new comment at the top of each page", that is, the so-called reverse display comments, but the topic only
Is it cool to be a total station statistic? Long-term blog fewer and less, why not give yourself a statistic to see how much they have worked on this blog, not only to give themselves to tourists, wp_count_posts is used in WordPress to count the number of articles in the function, You can count all types of articles (post) and Pages (page).
DescribeWp_count_posts is a function to count the
Number of wordpress articles in a certain period of time
The number of articles in wordpress in a certain period of time. you can view the specific effect on a non-cold blog.
Function num_posts ($ days = 1) {// $ days indicates a day;
Global $ wpdb;
$ Today = gmdate ('Y-m-d H: I: S', time (
How to optimize the following WordPress code, currently it is a separate query, resulting in a large number of database queries, in fact, is to achieve a one-time access to data, the cyclic output classification name, classification of article number.
$value){ ?>
">
On the WordPress blog, the total number of messages for each message recipient is displayed. The effect is as follows:
The method is simple. Add the following code to the funtions. php file:
Function commentCountAuthor () {$ oneText = 'one comment ';$ MoreText = '% comments'; global $ wpdb; $ result = $ wpdb-> get_var ('SELECTCOUNT (comment_ID)FROM'. $ Wpdb-> comments .'WHEREComment_author_email = "'. g
1. The number of times the database is queried when the web page is loaded: 2. Time taken by the server to complete these queries: Add the following code to the proper position of footer. php to display the wordpress database query times and query time (the third time ):Executed on this page
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.