Last active
February 29, 2024 23:27
-
-
Save bacoords/48beb404378a3124cad00dafb99aa5b5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register block styles. | |
* | |
* @return void | |
*/ | |
function prefix_register_block_styles() { | |
$site_icon = get_site_icon_url(); | |
if ( $site_icon ) { | |
register_block_style( | |
'core/site-logo', | |
array( | |
'name' => 'mobile-site-icon', | |
'label' => __( 'Mobile Icon Only', 'agency-fifty-three' ), | |
'inline_style' => '@media (max-width: 551px){ | |
.wp-block-site-logo.is-style-mobile-site-icon .custom-logo-link { | |
background-image: url(' . esc_url( $site_icon ) . '); | |
width:45px; height:45px; | |
background-size: contain; | |
} | |
.wp-block-site-logo.is-style-mobile-site-icon img { | |
display:none; | |
} | |
}', | |
) | |
); | |
} | |
} | |
add_action( 'init', 'prefix_register_block_styles' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment