<style type="text/css">
#sbi_mod_error{ display: block; }
</style>
<style type="text/css">
.site-header nav ul li.current-menu-item a:link,
.site-header nav ul li.current-menu-item a:visited,
.site-header nav ul li.current-page-ancestor a:link,
.site-header nav ul li.current-page-ancestor a:visited {
background-color: ;
}
.date-new,
.btn-primary,
.btn-primary-a,
.btn-primary-a:link,
.btn-primary-a:visited,
div.hd-search #searchsubmit {
background-color: ;
}
footer {
background: ;
}
.btn-primary:hover,
div.hd-search #searchsubmit:hover {
background-color: ;
}
.navbar,
.dropdown-menu {
background-color: ;
}
.widget-title,
.cat>a {
border-bottom: ;
}
.read-more {
border: 1px solid ;
}
.widget ul li::before {
color: ;
}
body {
background: ;
}
</style>
<style type="text/css">.recentcomments a{display:inline
!important;padding:0 !important;margin:0 !important
</style>
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<style type="text/css" media="screen">
html { margin-top: 32px !important; }
* html body { margin-top: 32px !important; }
@media screen and ( max-width: 782px ) {
html { margin-top: 46px !important; }
* html body { margin-top: 46px !important; }
}
</style>
当我进入“自定义”,进行更改并保存时,一切都已完成。会帮助我吗?这是我的customize.php文件:
<?php
// Customize Appearance Options
function Clean_Blog_Customize_Register( $wp_customize ) {
$wp_customize->add_setting('lwp_link_color', array(
'default' => '#000',
'transport' => 'refresh',
));
$wp_customize->add_setting('lwp_btn_color', array(
'default' => '#007bff',
'transport' => 'refresh',
));
$wp_customize->add_setting('lwp_nav_color', array(
'default' => '#262626',
'transport' => 'refresh',
));
$wp_customize->add_setting('lwp_btn_hover_color', array(
'default' => '#49a1ff',
'transport' => 'refresh',
));
$wp_customize->add_setting('lwp_footer_color', array(
'default' => '#1a1a1a',
'transport' => 'refresh',
));
$wp_customize->add_setting('lwp_borders_color', array(
'default' => '#007bff',
'transport' => 'refresh',
));
$wp_customize->add_setting('lwp_background_color', array(
'default' => '#f2f2f2',
'transport' => 'refresh',
));
$wp_customize->add_section('lwp_standard_colors', array(
'title' => __('Standard Colors', 'CleanBlog'),
'priority' => 30,
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_link_color_control', array(
'label' => __('Link Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_link_color',
) ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_btn_color_control', array(
'label' => __('Button Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_btn_color',
) ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_btn_hover_color_control', array(
'label' => __('Button Hover Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_btn_hover_color',
) ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_nav_color', array(
'label' => __('Navigation Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_nav_color',
) ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_footer_color', array(
'label' => __('Footer Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_footer_color',
) ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_borders_color', array(
'label' => __('Bordes Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_borders_color',
) ) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize,
'lwp_background_color', array(
'label' => __('Background Color', 'CleanBlog'),
'section' => 'lwp_standard_colors',
'settings' => 'lwp_background_color',
) ) );
// Add a footer/copyright information section.
$wp_customize->add_panel( 'text_blocks', array(
'priority' => 500,
'theme_supports' => '',
'title' => __('Text Blocks', 'CleanBlog'),
'description' => __( 'Set editable text for certain content.', 'CleanBlog'
),
) );
$wp_customize->add_section( 'custom_footer_text' , array(
'title' => __('Change Footer Text','CleanBlog'),
'panel' => 'text_blocks',
'priority' => 10
) );
// Add setting
$wp_customize->add_setting( 'footer_text_block', array(
'default' => __( 'default text', 'CleanBlog' ),
'sanitize_callback' => 'sanitize_text'
) );
// Add control
$wp_customize->add_control( new WP_Customize_Control( $wp_customize,
'custom_footer_text', array(
'label' => __( 'Footer Text', 'CleanBlog' ),
'section' => 'custom_footer_text',
'settings' => 'footer_text_block',
'type' => 'text'
)));
// End Adding a footer/copyright information section.
$wp_customize->add_panel( 'panel_id', array(
'priority' => 2,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Social Media Links', 'textdomain' ),
'description' => __( 'Description of what this panel does.', 'textdomain'
),
) );
//Facebook
$wp_customize->add_section( 'section_id', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Social Links', 'textdomain' ),
'description' => '',
'panel' => 'panel_id',
) );
$wp_customize->add_setting( 'facebook_link', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => '',
'sanitize_callback' => 'esc_url',
) );
$wp_customize->add_control( 'facebook_link', array(
'type' => 'url',
'priority' => 10,
'section' => 'section_id',
'label' => __( 'Facebook URL', 'textdomain' ),
'description' => '',
) );
//Twitter
$wp_customize->add_setting( 'twitter_link', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => '',
'sanitize_callback' => 'esc_url',
) );
$wp_customize->add_control( 'twitter_link', array(
'type' => 'url',
'priority' => 10,
'section' => 'section_id',
'label' => __( 'Twitter URL', 'textdomain' ),
'description' => '',
) );
//YouTube
$wp_customize->add_setting( 'youtube_link', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => '',
'sanitize_callback' => 'esc_url',
) );
$wp_customize->add_control( 'youtube_link', array(
'type' => 'url',
'priority' => 10,
'section' => 'section_id',
'label' => __( 'YouTube URL', 'textdomain' ),
'description' => '',
) );
//Linkedin
$wp_customize->add_setting( 'linkedin_link', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => '',
'sanitize_callback' => 'esc_url',
) );
$wp_customize->add_control( 'linkedin_link', array(
'type' => 'url',
'priority' => 10,
'section' => 'section_id',
'label' => __( 'Linkedin URL', 'textdomain' ),
'description' => '',
) );
//google_plus
$wp_customize->add_setting( 'google_plus_link', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => '',
'sanitize_callback' => 'esc_url',
) );
$wp_customize->add_control( 'google_plus_link', array(
'type' => 'url',
'priority' => 10,
'section' => 'section_id',
'label' => __( 'Google Plus URL', 'textdomain' ),
'description' => '',
) );
}
// Sanitize text
function sanitize_text( $text ) {
return sanitize_text_field( $text );
}
add_action('customize_register', 'Clean_Blog_Customize_Register');
// Output Customize CSS
function Clean_Blog_Customize_Css()
{
?>
<style type="text/css">
.site-header nav ul li.current-menu-item a:link,
.site-header nav ul li.current-menu-item a:visited,
.site-header nav ul li.current-page-ancestor a:link,
.site-header nav ul li.current-page-ancestor a:visited {
background-color: <?php echo get_theme_mod('lwp_link_color'); ?>;
}
.date-new,
.btn-primary,
.btn-primary-a,
.btn-primary-a:link,
.btn-primary-a:visited,
div.hd-search #searchsubmit {
background-color: <?php echo get_theme_mod('lwp_btn_color'); ?>;
}
footer {
background: <?php echo get_theme_mod('lwp_footer_color'); ?>;
}
.btn-primary:hover,
div.hd-search #searchsubmit:hover {
background-color: <?php echo get_theme_mod('lwp_btn_hover_color'); ?>;
}
.navbar,
.dropdown-menu {
background-color: <?php echo get_theme_mod('lwp_nav_color'); ?>;
}
.widget-title,
.cat>a {
border-bottom: 1px solid <?php echo
get_theme_mod('lwp_borders_color'); ?>;
}
.read-more {
border: 1px solid <?php echo get_theme_mod('lwp_borders_color'); ?>;
}
.widget ul li::before {
color: <?php echo get_theme_mod('lwp_borders_color'); ?>;
}
body {
background: <?php echo get_theme_mod('lwp_background_color'); ?>;
}
</style>
<?php
}
add_action('wp_head', 'Clean_Blog_Customize_Css');
答案 0 :(得分:0)
主题选项默认背景颜色设置使用代码
background-color: <?php echo get_theme_mod('lwp_link_color','#b71757'); ?>;