Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DigitalEssence/823456ecf565e0aba6c8271abb2b881e to your computer and use it in GitHub Desktop.
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
// 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