add_setting( 'artmag_frontpage_recent_posts' , array(
'default' => '0',
'transport' => 'refresh',
'sanitize_callback' => 'frontpage_recent_posts_sanitize'
) );
$wp_customize->add_setting( 'artmag_accent_color' , array(
'default' => '#ddc818',
'transport' => 'postMessage',
'sanitize_callback' => 'accent_color_sanitize'
) );
$wp_customize->add_setting( 'artmag_accent_letters' , array(
'default' => 'art',
'transport' => 'postMessage',
'sanitize_callback' => 'accent_letters_sanitize',
) );
$wp_customize->add_setting( 'artmag_number_of_recent_posts' , array(
'default' => '8',
'transport' => 'refresh',
'sanitize_callback' => 'recent_posts_sanitize',
) );
$wp_customize->add_setting( 'artmag_number_of_categories' , array(
'default' => '10',
'transport' => 'refresh',
'sanitize_callback' => 'num_categories_sanitize',
) );
$wp_customize->add_setting( 'artmag_include_footer' , array(
'default' => 1,
'transport' => 'refresh',
'sanitize_callback' => 'include_footer_sanitize'
) );
$wp_customize->remove_section('static_front_page');
$wp_customize->remove_section('colors');
$wp_customize->remove_control('background_repeat');
$wp_customize->remove_control('background_position_x');
$wp_customize->remove_control('background_attachment');
$wp_customize->add_section( 'artmag_frontpage' , array(
'title' => __( 'Front Page', 'artmgag' ),
'priority' => 30,
) );
$wp_customize->add_section( 'artmag_accent_color_section' , array(
'title' => __( 'Accent Color', 'artmgag' ),
'priority' => 30,
) );
$wp_customize->add_section( 'artmag_footer_section' , array(
'title' => __( 'Footer', 'artmgag' ),
'priority' => 30,
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'accent_color', array(
'label' => __( 'Accent Color', 'artmag' ),
'section' => 'artmag_accent_color_section',
'settings' => 'artmag_accent_color',
) )
);
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'artmag_accent_letters',
array(
'label' => __( 'Letters to highlight (a-z):', 'artmag' ),
'section' => 'artmag_accent_color_section',
'settings' => 'artmag_accent_letters',
'type' => 'text'
)
)
);
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'artmag_include_footer',
array(
'label' => __( 'Include Footer?', 'artmag' ),
'section' => 'artmag_footer_section',
'settings' => 'artmag_include_footer',
'type' => 'radio',
'choices' => array(
1 => 'yes',
0 => 'no'
)
)
)
);
$wp_customize->add_control(new WP_Customize_Control($wp_customize, 'artmag_frontpage_recent_posts',
array(
'label' => __( 'Front page will display:', 'artmag' ),
'section' => 'artmag_frontpage',
'settings' => 'artmag_frontpage_recent_posts',
'type' => 'radio',
'choices' => array(
'1' => 'posts',
'0' => 'static tagline'
)
)
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'artmag_number_of_recent_posts',
array(
'label' => __( 'Number of recent posts', 'artmag' ),
'section' => 'artmag_footer_section',
'settings' => 'artmag_number_of_recent_posts',
'type' => 'select',
'choices' => array(
'100000' => "no limit",
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
'11' => '11',
'12' => '12',
'13' => '13',
'14' => '14',
'15' => '15'
)
)
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'artmag_number_of_categories',
array(
'label' => __( 'Number of categories', 'artmag' ),
'section' => 'artmag_footer_section',
'settings' => 'artmag_number_of_categories',
'type' => 'select',
'choices' => array(
'10000' => 'no limit',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
'11' => '11',
'12' => '12',
'13' => '13',
'14' => '14',
'15' => '15'
)
)
)
);
}
function frontpage_recent_posts_sanitize( $value ) {
return $value;
}
function accent_color_sanitize( $value ) {
return $value;
}
function accent_letters_sanitize( $value ) {
$value = preg_replace("/[^A-Za-z ]+/", "", $value);
if ($value == "") $value = "art";
return $value;
}
function recent_posts_sanitize( $value ) {
return $value;
}
function num_categories_sanitize( $value ) {
return $value;
}
function include_footer_sanitize( $value ) {
return $value;
}
function mytheme_customize_css()
{
?>
'ffffff',
'default-image' => $default_image_path,
'default-repeat' => '',
'default-position-x' => '',
'wp-head-callback' => 'artmag_background_callback',
'admin-head-callback' => '',
'admin-preview-callback' => ''
);
add_theme_support( 'custom-background', $artmag_bg_defaults );
add_filter( 'the_content_more_link', 'modify_read_more_link' );
function modify_read_more_link() {
return '
read more...';
}
add_filter( 'thread_comments_depth_max', 'comment_depth_callback' );
function comment_depth_callback(){
return 2;
}
function artmag_background_callback() {
$background = set_url_scheme( get_background_image() );
$color = get_background_color();
if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {
$color = false;
}
if ( ! $background && ! $color )
return;
$style = $color ? "background-color: #$color;" : '';
if ( $background ) {
$image = " background-image: url('$background');";
$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) );
if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )
$repeat = 'repeat';
$repeat = " background-repeat: $repeat;";
$position = get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
$position = 'left';
$position = " background-position: top $position;";
$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
$attachment = 'scroll';
$attachment = " background-attachment: $attachment;";
$style .= $image . $repeat . $position . $attachment;
}
?>