public function header_image_filter($url) { // Bail out now if not in post (is_single or is_page) or blog (is_home) if (!is_single() && !is_page() && !is_home()) { return $url; } // Get current post ID (if on blog, then checks current posts page for it's ID) if (is_home()) { $post_id = get_option('page_for_posts'); } else { $post_id = get_the_ID(); } // Get attachment ID $attachment_id = Custom_Image_Meta_Box::get_attachment_id($post_id, $this->name_underscores); // Generate new URL if (is_numeric($attachment_id)) { $url = Custom_Image_Meta_Box::get_attachment_src($attachment_id); } return $url; }