カスタム背景は背景色とイメージをカスタマイズするために提供するテーマ機能です。
Custom Backgrounds is a theme feature that provides for customization of the background color and image.
外観の背景画面を参照してください。
See also Appearance Background Screen.
テーマのサポートを追加する
バージョン3.4以降、テーマは次のようにカスタムの背景をサポートしている場合にはfunctions.phpファイルにadd_theme_support()を使用する必要があります。
Since Version 3.4, themes need to use add_theme_support() in the functions.php file to supports custom backgrounds, like so:
add_theme_support( 'custom-background' );
あなたがデフォルトの引数を使用して追加できることに注意してください。
Note that you can add default arguments using:
$defaults = array( 'default-color' => '', 'default-image' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults );
例
‘background.jpg’の背景画像で、デフォルトの’#000000’背景色を使用する例です。
An example using default ‘#000000’ background color with ‘background.jpg’ background image:
$args = array( 'default-color' => '000000', 'default-image' => get_template_directory_uri() . '/images/background.jpg', ); add_theme_support( 'custom-background', $args );
関連
Theme Support: add_theme_support(), remove_theme_support(), current_theme_supports()
Theme Features: widgets, menus, post-formats, post-thumbnails, custom-background, custom-header, automatic-feed-links, editor-style