Skip to content

Instantly share code, notes, and snippets.

@rabindratharu
Created August 6, 2024 07:12
Show Gist options
  • Select an option

  • Save rabindratharu/7b8b55657691005be4bba77408b97008 to your computer and use it in GitHub Desktop.

Select an option

Save rabindratharu/7b8b55657691005be4bba77408b97008 to your computer and use it in GitHub Desktop.
FSE theme set Site Logo in One Click Demo Import
/**
* Add theme support.
*
* @since 1.0.0
*
* @return void
*/
if ( ! function_exists( 'rabindra_tharu_setup' ) ) {
function rabindra_tharu_setup() {
// Custom Logo
add_theme_support( 'custom-logo' );
}
}
add_action( 'after_setup_theme', 'rabindra_tharu_setup' );
/*
* Set Site Logo
* As we know that there is no particular site logo option in FSE theme so we will use site icon as site logo.
*/
add_action('ocdi/after_import', function () {
$favicon_id = get_option( 'site_icon' );
if ( isset( $favicon_id ) || absint( $favicon_id ) ) {
$media_object = get_post( $favicon_id );
set_theme_mod( 'custom_logo', absint( $media_object->ID ) );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment