Skip to content

Commit

Permalink
removing slow db query
Browse files Browse the repository at this point in the history
  • Loading branch information
rclations committed Dec 16, 2016
1 parent 5c7cd0a commit a56a2cf
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions inc/images.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ function largo_home_icon( $class = '', $size = '60x60' ) {
$default = '<i class="icon-home ' . esc_attr( $class ) . '"></i>';

if ( ! empty( $logo ) ) {
$attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid = %s", $logo ) );
if ( !empty( $attachment_id ) )
echo wp_get_attachment_image( $attachment_id, $size );
else {
if ( preg_match( '/^http(s)?\:\/\//', $logo ) )
echo '<img src="' . $logo . '" class="attachment-home-logo" alt="logo">';
else
echo $default;
if ( preg_match( '/^http(s)?\:\/\//', $logo ) ) {
echo '<img src="' . $logo . '" class="attachment-home-logo" alt="logo">';
} else {
echo $default;
}
} else {
echo $default;
Expand Down

0 comments on commit a56a2cf

Please sign in to comment.