Created
April 11, 2019 09:04
-
-
Save DigitalEssence/823456ecf565e0aba6c8271abb2b881e to your computer and use it in GitHub Desktop.
WordPress - Enfold - PHP - Detect if a post date is in the past and add a class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detect if post is in the past and if so add a custom Class "oldpost" | |
if (strtotime(get_the_date( "Y-m-d", $the_id )) < strtotime(date("Y-m-d"))) { | |
$post_class = "post-entry post-entry-{$the_id} oldpost slide-entry-overview slide-loop-{$post_loop_count} slide-parity-{$parity} {$last}"; | |
} | |
else { | |
$post_class = "post-entry post-entry-{$the_id} slide-entry-overview slide-loop-{$post_loop_count} slide-parity-{$parity} {$last}"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment