Php Web服务器上的WP自定义程序不更改CSS
我在WordPress中创建了自己的主题,用户可以在其中设置自定义的背景色 当在XAMPP上本地运行时,我没有问题,但是当我将主题上传到web服务器时,背景色消失了。当我进入Customizer选项卡时,背景颜色是正确的。Web服务器上的WordPress是新安装的 这一行似乎是缺少颜色的原因:Php Web服务器上的WP自定义程序不更改CSS,php,html,css,wordpress,wordpress-theming,Php,Html,Css,Wordpress,Wordpress Theming,我在WordPress中创建了自己的主题,用户可以在其中设置自定义的背景色 当在XAMPP上本地运行时,我没有问题,但是当我将主题上传到web服务器时,背景色消失了。当我进入Customizer选项卡时,背景颜色是正确的。Web服务器上的WordPress是新安装的 这一行似乎是缺少颜色的原因: 它在页眉和页脚应为绿色的Web服务器上的外观。 当我打开customizer选项卡时,颜色是正确的。 这只是代码的一部分 请联系我的完整网站 有人能帮我吗 /* ================
它在页眉和页脚应为绿色的Web服务器上的外观。
当我打开customizer选项卡时,颜色是正确的。
这只是代码的一部分
请联系我的完整网站
有人能帮我吗
/*
================================
Customize Appearance Options
================================
*/
function info_customize_register( $wp_customize ){
// Add setting
$wp_customize->add_setting('info_txt_color', array(
'default' => '#FFF',
'transport' => 'refresh',
));
$wp_customize->add_setting('info_bg_color', array(
'default' => '#287e43',
'transport' => 'refresh',
));
$wp_customize->add_setting('info_border_color', array(
'default' => '#ba2e25',
'transport' => 'refresh',
));
$wp_customize->add_setting( 'info_logo' );
$wp_customize->add_setting('text_setting', array(
'default' => 'Logo',
));
// Add section
$wp_customize->add_section('info_colors',array(
'title' => __('Farver','info'),
'priority' => 30,
));
$wp_customize->add_section('info_header_logo',array(
'title' => __('Logo','info'),
'priority' => 30,
'description' => 'Upload et logo som vil erstatte "Logo" teksten i din header',
));
$wp_customize->add_section('footer_settings_section', array(
'title' => 'Footer Text Section'
));
// Add control
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_txt_color_control', array(
'label' => __('Tekst Farve','info'),
'section' => 'info_colors',
'settings' => 'info_txt_color',
)));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_bg_color_control', array(
'label' => __('Baggrunds Farve','info'),
'section' => 'info_colors',
'settings' => 'info_bg_color',
)));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_border_color_control', array(
'label' => __('Border Farve','info'),
'section' => 'info_colors',
'settings' => 'info_border_color',
)));
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'info_logo_control', array(
'label' => __( 'Logo', 'info' ),
'section' => 'info_header_logo',
'settings' => 'info_logo',
)));
$wp_customize->add_control('text_setting', array(
'label' => 'Logo Tekst',
'section' => 'info_header_logo',
'type' => 'textarea',
));
}
add_action( 'customize_register' , 'info_customize_register' );
/*
================================
Customize Appearance Options
================================
*/
function info_customize_css() { ?>
<style type="text/css">
header p, #digital-time {
color: <?php echo get_theme_mod('info_txt_color'); ?>;
}
header {
background-color: <?php echo get_theme_mod('info_bg_color'); ?>;
border-bottom: 4px solid <?php echo get_theme_mod('info_border_color'); ?>;
}
footer {
background-color: <?php echo get_theme_mod('info_bg_color'); ?>;
border-top: 4px solid <?php echo get_theme_mod('info_border_color'); ?>;
}
</style>
<?php }
add_action( 'wp_head' , 'info_customize_css' );
/*
================================
自定义外观选项
================================
*/
函数信息\自定义\寄存器($wp\自定义){
//添加设置
$wp\u自定义->添加\u设置('info\u txt\u color',数组(
“默认值”=>“#FFF”,
“传输”=>“刷新”,
));
$wp\u自定义->添加\u设置('info\u bg\u color',数组(
'默认'=>'#287e43',
“传输”=>“刷新”,
));
$wp\u自定义->添加\u设置('info\u border\u color',数组(
'默认'=>'#ba2e25',
“传输”=>“刷新”,
));
$wp_自定义->添加_设置('info_徽标');
$wp\u自定义->添加\u设置('text\u设置',数组(
“默认设置”=>“徽标”,
));
//添加节
$wp\u自定义->添加\u部分('info\u colors',数组(
“title'=>”('Farver','info'),
“优先级”=>30,
));
$wp\u自定义->添加\u部分('info\u header\u logo',数组(
“title”=>“‘Logo’、‘info’”,
“优先级”=>30,
'description'=>'上传et徽标som vil erstatte“徽标”teksten i din标题',
));
$wp\u customize->add\u section('footer\u settings\u section',数组(
“标题”=>“页脚文本部分”
));
//添加控件
$wp\u customize->add\u控件(新wp\u customize\u Color\u控件($wp\u customize,'info\u txt\u Color\u control',数组(
“标签”=>“'Tekst Farve','info'),
'部分'=>'信息颜色',
“设置”=>“信息文本颜色”,
)));
$wp\u customize->add\u控件(新wp\u customize\u Color\u控件($wp\u customize,'info\u bg\u Color\u control',数组(
“标签”=>“‘Baggrunds Farve’,‘info’”,
'部分'=>'信息颜色',
“设置”=>“信息背景颜色”,
)));
$wp\u customize->add\u控件(新wp\u customize\u Color\u控件($wp\u customize,'info\u border\u Color\u control',数组(
“label'=>”(“Border Farve”,“info”),
'部分'=>'信息颜色',
“设置”=>“信息\u边框\u颜色”,
)));
$wp\u customize->add\u控件(新wp\u customize\u图像\u控件($wp\u customize,'info\u logo\u control',数组(
“标签”=>u uu('Logo','info'),
'部分'=>'信息标题'',
“设置”=>“信息标志”,
)));
$wp\u自定义->添加\u控件('text\u setting',数组(
“标签”=>“商标Tekst”,
'部分'=>'信息标题'',
'type'=>'textarea',
));
}
添加操作(“自定义注册表”、“信息自定义注册表”);
/*
================================
自定义外观选项
================================
*/
函数信息\u自定义\u css(){?>
标题p,#数字时间{
颜色:;
}
标题{
背景色:;
边框底部:4px实心;
}
页脚{
背景色:;
边框顶部:4倍实心;
}
/*
================================
Customize Appearance Options
================================
*/
function info_customize_register( $wp_customize ){
// Add setting
$wp_customize->add_setting('info_txt_color', array(
'default' => '#FFF',
'transport' => 'refresh',
));
$wp_customize->add_setting('info_bg_color', array(
'default' => '#287e43',
'transport' => 'refresh',
));
$wp_customize->add_setting('info_border_color', array(
'default' => '#ba2e25',
'transport' => 'refresh',
));
$wp_customize->add_setting( 'info_logo' );
$wp_customize->add_setting('text_setting', array(
'default' => 'Logo',
));
// Add section
$wp_customize->add_section('info_colors',array(
'title' => __('Farver','info'),
'priority' => 30,
));
$wp_customize->add_section('info_header_logo',array(
'title' => __('Logo','info'),
'priority' => 30,
'description' => 'Upload et logo som vil erstatte "Logo" teksten i din header',
));
$wp_customize->add_section('footer_settings_section', array(
'title' => 'Footer Text Section'
));
// Add control
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_txt_color_control', array(
'label' => __('Tekst Farve','info'),
'section' => 'info_colors',
'settings' => 'info_txt_color',
)));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_bg_color_control', array(
'label' => __('Baggrunds Farve','info'),
'section' => 'info_colors',
'settings' => 'info_bg_color',
)));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_border_color_control', array(
'label' => __('Border Farve','info'),
'section' => 'info_colors',
'settings' => 'info_border_color',
)));
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'info_logo_control', array(
'label' => __( 'Logo', 'info' ),
'section' => 'info_header_logo',
'settings' => 'info_logo',
)));
$wp_customize->add_control('text_setting', array(
'label' => 'Logo Tekst',
'section' => 'info_header_logo',
'type' => 'textarea',
));
}
add_action( 'customize_register' , 'info_customize_register' );
/*
================================
Customize Appearance Options
================================
*/
function info_customize_css() { ?>
<style type="text/css">
header p, #digital-time {
color: <?php echo get_theme_mod('info_txt_color'); ?>;
}
header {
background-color: <?php echo get_theme_mod('info_bg_color'); ?>;
border-bottom: 4px solid <?php echo get_theme_mod('info_border_color'); ?>;
}
footer {
background-color: <?php echo get_theme_mod('info_bg_color'); ?>;
border-top: 4px solid <?php echo get_theme_mod('info_border_color'); ?>;
}
</style>
<?php }
add_action( 'wp_head' , 'info_customize_css' );