0
我试图让我的Wordpress的十二个孩子的主题,以确保当主题被激活时背景是白色的。我不能将CSS添加到wp_head,因为用户无法设置自定义背景。在主题加载上设置WP custombackground颜色
我一直在寻找的after_setup_theme钩
function set_white_bg() {
set_theme_mod(custom-background, 'ffffff'); }
add_action('after_setup_theme', 'set_white_bg');
我也试了这一点 - 再次没有运气
function wpse64373_set_custom_background($new_colour)
{
$old_colour = get_theme_mod(
'background_color'
,get_theme_support('custom-background', 'default-color')
);
if ($old_colour == $new_colour)
return;
return set_theme_mod('background_color', $new_colour);
}
function wpse64373_update_custom_background()
{ wpse64373_set_custom_background('ffffff'); }
add_action('switch_theme', 'wpse64373_update_custom_background');
我在做什么错在这里?
谢谢,但它不工作。背景保持与以前相同的颜色。 – MadsRH 2013-03-22 09:12:03