Skip to content

Commit

Permalink
モバイルロゴ属性にwidthとheight属性を付加
Browse files Browse the repository at this point in the history
※本当に必要か?
  • Loading branch information
yhira committed Apr 8, 2024
1 parent e9c31d2 commit 3692338
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tmp/mobile-logo-button.php
Expand Up @@ -14,11 +14,22 @@
$home_url = apply_filters('mobile_header_site_logo_url', $home_url);
$site_logo_text = apply_filters('site_logo_text', get_bloginfo('name'));
$site_logo_text = apply_filters('mobile_header_site_logo_text', $site_logo_text);
$logo_url = get_the_site_logo_url();
$size = get_image_width_and_height($logo_url);
$width_attr = null;
$height_attr = null;
if ($size) {
$w = $size['width'];
$h = $size['height'];
if ($w && $h) {
$width_attr = ' widht="'.$w.'"';
$height_attr = ' height="'.$h.'"';
}
}
?>
<!-- ロゴボタン -->
<li class="logo-menu-button menu-button">
<a href="<?php echo esc_url($home_url); ?>" class="menu-button-in"><?php
$logo_url = get_the_site_logo_url();
//ロゴが存在する場合は画像
if ($logo_url): ?><img class="site-logo-image" src="<?php echo esc_url($logo_url); ?>" alt="<?php echo esc_attr($site_logo_text); ?>"><?php else: ?><?php echo $_MENU_CAPTION ? $_MENU_CAPTION : $site_logo_text; ?><?php endif; ?></a>
if ($logo_url): ?><img class="site-logo-image" src="<?php echo esc_url($logo_url); ?>" alt="<?php echo esc_attr($site_logo_text); ?>"<?php echo $width_attr; ?><?php echo $height_attr; ?>><?php else: ?><?php echo $_MENU_CAPTION ? $_MENU_CAPTION : $site_logo_text; ?><?php endif; ?></a>
</li>

0 comments on commit 3692338

Please sign in to comment.