Wordpress implements the method of turning comments to pages and comments in chronological order

Source: Internet
Author: User

Because the message board of this blog uses an article template, the message is naturally a comment system. Today, we occasionally find that the comment is not in chronological order, so it's easy. Now let's share it with you! Is a collection of many methods on the Internet! The specific effect is shown in the following figure:

1. Arrange comments in chronological order, with the latest comments at the beginning
1. Set it in the background-settings-discussion area as shown in the following figure:

2. Find the comment-template.php file under the/wp-PRODES/program and make the following changes:

Use ctrl + F to search

The code is as follows: Copy code

Order by comment_date_gmt

Change it

The code is as follows: Copy code

Order by comment_date DESC (two places in total)

Now, all the comments are arranged in chronological order. Next we will introduce how to change pages to beautiful spots.

2. wordpress review

The default comment page turning is very inconvenient and ugly. The program developed by foreign users is of course a habit of foreigners. So I will modify it and the effect can be viewed on my message board!

1. Find the comments. Php file under the topic of your blog, and find it in it:

The code is as follows: Copy code

<Div id = "comments-nav"> <! -Of course, this DIV may not affect the writing of different blogs and CSS. For details, see->
<Div class = "alignleft"> <? Php previus_comments_link (")?> </Div>
<Div class = "alignright"> <? Php next_comments_link (")?> </Div>
</Div>

Change it

The code is as follows: Copy code

<Div class = "comments-navi"> <! -My own CSS is used here. In order to conflict with the previous CSS, I will change the CSS name to comments-navi. Because the CSS name is defined by., the ID is changed to class->
<? Php paginate_comments_links ('prev _ text = previous page & next_text = next page ');?>
</Div>

The following is the CSS code. Copy it to the top or bottom of the comments. Php file and write it to your CSS for calling. Note that the name conflict exists.

The code is as follows: Copy code

<Style type = "text/css">
. Comments-navi {
Float: left;
Font-size: 12px;
Line-height: 22px;
Width: 100%;
Text-align: center;
}
. Comments-navi {
Text-decoration: none;
Border: 1px solid # ccc;
Color: #555;
Margin: 2px;
Padding: 2px 4px;
}
. Comments-navi a: hover {
Border: 1px solid # ccc;
Color: # ccc;
Background: #555;
}

. Comments-navi span. current {
Font-weight: 700;
Border: 1px solid # ccc;
Color: #555;
Background: # F6F6F6;
Margin: 2px;
Padding: 2px 4px;
}
</Style>

 

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.