Home>Article>CMS Tutorial> How to add special styles to articles published within a certain period of time in WordPress
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!
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!