Skip to content

Commit

Permalink
Changed the output location of CSS for maximum logo height
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdkei committed Jun 18, 2024
1 parent 94a0114 commit 7d0d183
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions _g3/inc/customize/customize-design.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,54 +65,54 @@ function lightning_customize_register_design( $wp_customize ) {
)
);

// ロゴの最大の高さ(PC)の設定とコントロール
// Logo max height (PC)
$wp_customize->add_setting(
'lightning_theme_options[logo_max_height_pc]',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint', // 数値をサニタイズ
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
'logo_max_height_pc',
array(
'label' => __( 'Logo max height (PC)', 'lightning' ),
'label' => __( 'Logo max height [PC]', 'lightning' ),
'section' => 'lightning_design',
'settings' => 'lightning_theme_options[logo_max_height_pc]',
'type' => 'number',
'priority' => 502,
'input_attrs' => array(
'min' => 0,
'step' => 1,
'suffix' => 'px', // px単位
'suffix' => 'px',
),
)
);

// ロゴの最大の高さ(モバイル)の設定とコントロール
// Logo max height (Mobile)
$wp_customize->add_setting(
'lightning_theme_options[logo_max_height_mobile]',
array(
'default' => '',
'type' => 'option',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'absint', // 数値をサニタイズ
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control(
'logo_max_height_mobile',
array(
'label' => __( 'Logo max height (Mobile)', 'lightning' ),
'label' => __( 'Logo max height [Mobile]', 'lightning' ),
'section' => 'lightning_design',
'settings' => 'lightning_theme_options[logo_max_height_mobile]',
'type' => 'number',
'priority' => 503,
'input_attrs' => array(
'min' => 0,
'step' => 1,
'suffix' => 'px', // px単位
'suffix' => 'px',
),
)
);
Expand Down Expand Up @@ -190,6 +190,18 @@ function lightning_get_common_inline_css() {
--g_nav_sub_acc_icon_close_url: url(' . get_template_directory_uri() . '/inc/vk-mobile-nav/package/images/vk-menu-close-white.svg);
}
';

// Logo max height
$max_height_pc = ! empty( $options['logo_max_height_pc'] ) ? absint( $options['logo_max_height_pc'] ) : '';
$max_height_mobile = ! empty( $options['logo_max_height_mobile'] ) ? absint( $options['logo_max_height_mobile'] ) : '';

if ( $max_height_pc ) {
$dynamic_css .= '@media (min-width: 992px) { .site-header-logo img { max-height: ' . $max_height_pc . 'px; } }';
}
if ( $max_height_mobile ) {
$dynamic_css .= '@media (max-width: 991px) { .site-header-logo img { max-height: ' . $max_height_mobile . 'px; } }';
}

// delete before after space.
$dynamic_css = trim( $dynamic_css );
// convert tab and br to space.
Expand Down

0 comments on commit 7d0d183

Please sign in to comment.