How to Get the Page ID Outside of the Loop

Love it or hate it, the Loop is the proper WordPress way to get posts and other metadata related to these posts. But sometimes you just need to get the current page or post ID outside of the loop. For example, you might want to create a hero banner in your header.php that uses metadata associated with the current page. When Read More