Using global $post; to get featured image for custom post via WP_Query

$port_query->the_post(); should set the $post global. That isn’t the problem. The problem is that the you are trying to use $post before your secondary Loop runs (99% sure).

You’ve hooked the bkg_featured_image() function to wp_head. wp_head runs in the header of the document, which, unless you are careful, will run before the other template code.

If you think about how WordPress theme template loading works, you will realize that get_header() loads header.php which should be where the header hooks fire. That means that code before get_header() in a theme file can use those hooks successfully.

The fix is to make sure your secondary loop runs before get_header(). $post should be set to the first post in those results and your code should work. That doesn’t mean you have to output the results before get_header(), which wouldn’t make sense. You just have to run the query.

Of course, you only have the first post in the Loop by doing it this way.