启用自定义背景
add_theme_support('自定义背景');
$args=阵列( “默认颜色”=>“0000ff”, “default-image”=>get_template_directory_uri()。“/ images/wapuu.jpg’, ); add_theme_support('自定义背景',$args);
显示自定义背景
<! DOCTYPE html> <html> <头部> <? php wp_head();?> </头> <车身<? php body_class();?>>
<! DOCTYPE html> <html lang=“en-US”class=“no-js”> <头部> ... <style type=“text/css”id=“custom-background-css”> 车身.客户背景{ 背景图像:url(“ http://example.com/wordpress/wp-content/themes/my-first-theme/images/wapuu.jpg "); 背景位置:左上; 背景尺寸:自动; 背景重复:重复; 背景附件:滚动; } </style> ... </头> <body class=“home page-template-default page page-id-211 logged-in admin-bar no-customize-support custom-background”> ...
另一个默认示例
$another_args=数组( “默认颜色”=>“0000ff”, “default-image”=>get_template_directory_uri()。“/ images/wapuu.jpg’, “default-position-x”=>“右”, 'default-position-y'=>'top', “default-repeat”=>“no-repeap”, ); add_theme_support('自定义背景',$another_args);