Skip to content

Instantly share code, notes, and snippets.

@terrylinooo
Created September 30, 2023 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terrylinooo/688c80e87918fd703d18bd9ff37afa9a to your computer and use it in GitHub Desktop.
Save terrylinooo/688c80e87918fd703d18bd9ff37afa9a to your computer and use it in GitHub Desktop.
get_theme_mod
/**
* 鐵人賽示範:自訂背景顏色
*
* @return void
*/
function ironman_customizer_css() {
$background_color = get_theme_mod( 'ironman_background_color_setting', '#ffffff' );
?>
<style type="text/css">
body {
background-color: <?php echo esc_attr( $background_color ); ?>;
}
</style>
<?php
}
add_action( 'wp_head', 'ironman_customizer_css' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment