Home>Article>CMS Tutorial> How to add special styles to articles published within a certain period of time in WordPress

How to add special styles to articles published within a certain period of time in WordPress

藏色散人
藏色散人 forward
2020-11-27 15:57:15 9213browse

The following columnWordPress Tutorialwill introduce to you how to solve the problem of upgradingWordPressto add special styles to articles published within a certain period of time. I hope it will help you if you need Friends help!

How to add special styles to articles published within a certain period of time in WordPress

Through the following code, you can add a "latest article" prompt or output different styles for articles published within a certain period of time, and add them to the main loop of the theme template.

Add special styles to articles published within a certain period of time

Code 1

post_date; $t2 = date( "Y-m-d H:i:s" ); $t3 = '24'; $period = ( strtotime( $t2 )-strtotime( $t1 ) )/3600; if ( $period < $t3 ) { ?> 一天之内  一天之外 

$t3 = '24', which is limited to 24 Within hours, modify the number to adjust the time.

Code 2

 一天之内  一天之外 

Modify 86400 seconds and adjust the time limit.

The above is the detailed content of How to add special styles to articles published within a certain period of time in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zmingcx.com. If there is any infringement, please contact admin@php.cn delete