I'm getting an error on a new page with the current Date posted
Notice : Undefined index: ama_text_field_01_2019 on line 57 /
When I checked the error line it says
$options = get_option( 'ama_settings' ); $field = 'ama_text_field_' . get_the_date("m") . '_' . get_the_date("Y"); 57: $options = get_option( 'ama_settings' ); $data = str_replace(' ', '', trim($options[$field]));
To troubleshoot, I changed the Date posted to 2018 instead of 2019. That fixed the error. But going forward this isn't a solution.
Any areas I can look into to fix?
I'm getting an error on a new page with the current Date posted
Notice : Undefined index: ama_text_field_01_2019 on line 57 http://magazine.americanmotorcyclist/6607/quest-completed/
When I checked the error line it says
$options = get_option( 'ama_settings' ); $field = 'ama_text_field_' . get_the_date("m") . '_' . get_the_date("Y"); 57: $options = get_option( 'ama_settings' ); $data = str_replace(' ', '', trim($options[$field]));
To troubleshoot, I changed the Date posted to 2018 instead of 2019. That fixed the error. But going forward this isn't a solution.
Any areas I can look into to fix?
To just get the post date, you can replace that entire section of code with just the get_the_date() function.
To display the article's date, use this code:
<?php echo get_the_date(); ?>
Check out the date format options on the codex page linked above to customize it to your liking, if necessary.