Last active
February 18, 2019 12:47
-
-
Save DigitalEssence/c8881ed0bd31e1ceda4cd0c2ed0f6a6c to your computer and use it in GitHub Desktop.
WordPress - Enfold - PHP - Check if a post date is in the past
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
| // For Enfold copy /enfold/config-templatebuilder/avia-shortcodes/postslider.php | |
| // to /child-theme/shortcodes/postslider/postslider.php | |
| // Add this query | |
| if (strtotime(get_the_date( "Y-m-d", $the_id )) < strtotime(date("Y-m-d"))) { | |
| //Do something | |
| } | |
| else { | |
| //Do nothing | |
| } | |
| // In functions.php add the following to enable child theme shortcodes | |
| // Enable shortcodes to be loaded from child theme - used for postslider.php edits | |
| add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1); | |
| function avia_include_shortcode_template($paths) | |
| { | |
| $template_url = get_stylesheet_directory(); | |
| array_unshift($paths, $template_url.'/shortcodes/'); | |
| return $paths; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment