Update display-form.php

Check if `$post->ID` is set to avoid PHP notice. Might happen, for example, on a search results page, when nothing is found.