Basically you got yourself a piece of code that blocks your PHP execution because it relies on external request wp_remote_get()
to finish in order to continue. And the worst part is you do it on every request, unconditionally 🙂 Easiest solution for you right now probably is to store all HTML that is generated based on that request into a transient. Check this out:
<?php
$trans_id = 'my_external_logos__name_me_good';
$external_logos = get_transient( $trans_id );
if ( false === $external_logos ) {
ob_start();
... what you did before ...
$external_logos = ob_get_clean();
set_transient( $trans_id, $external_logos, WEEK_IN_SECONDS );
}
echo $external_logos;
You could tweak WEEK_IN_SECONDS to any period in seconds (eg. DAY_IN_SECONDS constant). Now your code will execute only once a week and WP will serve the generated HTML from its database.