footer.php but it returns a wrong value.
It might come from any of the plugin which is altering The Loop without resetting it after with
wp_reset_postdata() as mentioned in $post->ID and the_id() always return the wrong value.
Indeed the page shows a list of recent posts, etc. so this might modify the current Loop.
If I can't modify this (because of third party code), how to get the ID of the current post in the footer anyway, with PHP?