In Wordpress (functions.php) I'm trying to make a function occur only if the post date is not equal to today's date.
The problem I seem to be running into is getting the post date from within functions.php rather than the theme file (page.php for example). Any ideas how to make this happen?
The problem I seem to be running into is getting the post date from within functions.php rather than the theme file (page.php for example). Any ideas how to make this happen?
PHP:
<?php
function internal_linking($string) {
$comp_date_1 = $post->post_date;
$comp_date_2 = date( 'Y-m-d' );
if ( $comp_date_1 != $comp_date_2 ){
do something;
}
return $string;
}
add_filter('the_content', 'internal_linking');
?>