diff --git a/functions.php b/functions.php index 801e2d9..5187a77 100644 --- a/functions.php +++ b/functions.php @@ -124,9 +124,7 @@ function decode_setup() { */ function decode_content_width() { - $width = get_theme_mod( 'content_width', 792 ); - - $GLOBALS['content_width'] = apply_filters( 'decode_content_width', $width ); + $GLOBALS['content_width'] = apply_filters( 'decode_content_width', 792 ); } add_action( 'after_setup_theme', 'decode_content_width', 0 ); diff --git a/header.php b/header.php index 6a7c87f..e119c34 100644 --- a/header.php +++ b/header.php @@ -17,10 +17,6 @@ -' . "\n" . - '' . "\n"; -} ?> '; } ?> @@ -78,9 +74,9 @@ -
+ - + diff --git a/inc/customizer.php b/inc/customizer.php index bd00c4d..928cec2 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -21,13 +21,6 @@ public function render_content() { get_setting( 'blogname' ) ->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' ) ->transport = 'postMessage'; + $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_image' )->transport = 'postMessage'; @@ -207,6 +200,7 @@ public static function decode_customize_register( $wp_customize ) { remove_theme_mod( 'steam_user' ); remove_theme_mod( 'steam_group' ); remove_theme_mod( 'show_all_post_types' ); + remove_theme_mod( 'favicon_image' ); $wp_customize->remove_setting( 'youtube_username' ); $wp_customize->remove_setting( 'show_site_navigation' ); $wp_customize->remove_setting( 'show_social_icons' ); @@ -215,6 +209,7 @@ public static function decode_customize_register( $wp_customize ) { $wp_customize->remove_setting( 'steam_user' ); $wp_customize->remove_setting( 'steam_group' ); $wp_customize->remove_setting( 'show_all_post_types' ); + $wp_customize->remove_setting( 'favicon_image' ); /** * Header Options @@ -224,12 +219,6 @@ public static function decode_customize_register( $wp_customize ) { 'title' => __( 'Header Options', 'decode' ), 'priority' => 32, ) ); - - - $wp_customize->add_setting( 'favicon_image', array( - 'default' => '', - 'sanitize_callback' => 'decode_sanitize_string', - ) ); $wp_customize->add_setting( 'show_site_title', array( 'default' => true, @@ -254,16 +243,6 @@ public static function decode_customize_register( $wp_customize ) { 'transport' => 'postMessage', 'sanitize_callback' => 'decode_sanitize_html', ) ); - - - $wp_customize->add_control( - new Decode_Customize_Favicon_Image_Control( - $wp_customize, 'favicon_image', array( - 'label' => __( 'Favicon Image (must be a PNG)', 'decode' ), - 'section' => 'decode_header_options', - 'settings' => 'favicon_image', - 'priority' => 1, - ) ) ); $wp_customize->add_control( 'show_site_title', array( 'label' => __( 'Show Site Title', 'decode' ), @@ -280,7 +259,7 @@ public static function decode_customize_register( $wp_customize ) { ) ); $wp_customize->add_control( 'show_header_menu', array( - 'label' => __( 'Show Header Menu', 'decode' ), + 'label' => __( 'Show Navigation Menu', 'decode' ), 'section' => 'decode_header_options', 'type' => 'checkbox', 'priority' => 4, @@ -1269,16 +1248,36 @@ public static function decode_customize_register( $wp_customize ) { ) ); -/** - * Reading Options - */ + /** + * Content Options + */ + $wp_customize->add_panel( 'decode_content_options_panel', array( + 'priority' => 37, + 'capability' => 'edit_theme_options', + 'theme_supports' => '', + 'title' => esc_html__( 'Content Options', 'decode' ) + ) ); - $wp_customize->add_section( 'decode_content_options', array( - 'title' => __( 'Content Options', 'decode' ), - 'priority' => 37, - 'description' => sprintf( _x( 'These options change the display of %s\'s content', '(blog name)\'s content.' ,'decode' ), get_bloginfo( 'name', 'display' ) ), - ) ); - + // General + $wp_customize->add_section( 'decode_content_options_general', array( + 'title' => __( 'General', 'decode' ), + 'priority' => 1, + 'panel' => 'decode_content_options_panel' + ) ); + + // Content + $wp_customize->add_section( 'decode_content_options_content', array( + 'title' => __( 'Content', 'decode' ), + 'priority' => 2, + 'panel' => 'decode_content_options_panel' + ) ); + + // Content Single + $wp_customize->add_section( 'decode_content_options_content_single', array( + 'title' => __( 'Content Single', 'decode' ), + 'priority' => 3, + 'panel' => 'decode_content_options_panel' + ) ); $wp_customize->add_setting( 'latin_extended_font', array( 'default' => false, @@ -1363,8 +1362,9 @@ public static function decode_customize_register( $wp_customize ) { ) ); $wp_customize->add_setting( 'content_width', array( - 'default' => 792, - 'sanitize_callback' => 'absint' + 'default' => 41.619, + 'sanitize_callback' => 'absint', + 'transport' => 'postMessage' ) ); $wp_customize->add_setting( 'site_colophon', array( @@ -1376,141 +1376,142 @@ public static function decode_customize_register( $wp_customize ) { $wp_customize->add_control( 'latin_extended_font', array( 'label' => __( 'Load Latin Extended character set. This will increase page load times.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'type' => 'checkbox', 'priority' => 1, ) ); $wp_customize->add_control( 'use_excerpts', array( 'label' => __( 'Use entry excerpts instead of full text on site home. Excludes sticky posts.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content', 'type' => 'checkbox', - 'priority' => 2, + 'priority' => 1, ) ); $wp_customize->add_control( 'use_excerpts_on_archives', array( 'label' => __( 'Use entry excerpts on archive, category, and author pages.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content', 'type' => 'checkbox', - 'priority' => 3, + 'priority' => 2, ) ); $wp_customize->add_control( 'show_featured_images_on_excerpts', array( 'label' => __( 'Display posts\' featured images when excerpts are shown.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content', 'type' => 'checkbox', - 'priority' => 4, + 'priority' => 3, ) ); $wp_customize->add_control( 'show_featured_images_on_singles', array( 'label' => __( 'Display a post\'s featured image on its individual page.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content_single', 'type' => 'checkbox', - 'priority' => 5, + 'priority' => 1, ) ); $wp_customize->add_control( 'show_tags', array( 'label' => __( 'Show tags on front page (tags will be shown on post\'s individual page)', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content', 'type' => 'checkbox', - 'priority' => 6, + 'priority' => 4, ) ); $wp_customize->add_control( 'show_categories', array( 'label' => __( 'Show categories on front page (categories will be shown on post\'s individual page)', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content', 'type' => 'checkbox', - 'priority' => 7, + 'priority' => 5, ) ); $wp_customize->add_control( 'show_author_section', array( 'label' => __( 'Show author\'s name, profile image, and bio after posts', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content_single', 'type' => 'checkbox', - 'priority' => 8, + 'priority' => 2, ) ); $wp_customize->add_control( 'show_leave_a_comment_link', array( 'label' => __( 'Show "Leave a comment" link after posts.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content_single', 'type' => 'checkbox', - 'priority' => 9, + 'priority' => 3, ) ); $wp_customize->add_control( 'entry_date_position', array( 'label' => __( 'Entry Date Position', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'type' => 'radio', 'choices' => array( 'above' => __( 'Above Header', 'decode' ), 'below' => __( 'Below Header', 'decode' ), ), - 'priority' => 10, + 'priority' => 2, ) ); $wp_customize->add_control( 'show_entry_date_on_excerpts', array( 'label' => __( 'Show entry date for post excepts on the main page', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content', 'type' => 'checkbox', - 'priority' => 11, + 'priority' => 6, ) ); $wp_customize->add_control( 'show_allowed_tags', array( 'label' => __( 'Show allowed HTML tags on comment form', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_content_single', 'type' => 'checkbox', - 'priority' => 12, + 'priority' => 4, ) ); $wp_customize->add_control( 'show_page_headers', array( 'label' => __( 'Show Page Headers', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'type' => 'checkbox', - 'priority' => 13, + 'priority' => 3, ) ); $wp_customize->add_control( 'link_post_title_arrow', array( 'label' => __( 'Add an arrow before the title of a link post', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'type' => 'checkbox', - 'priority' => 14, + 'priority' => 4, ) ); $wp_customize->add_control( 'show_theme_info', array( 'label' => __( 'Show Theme Info (display a line of text about the theme and its creator at the bottom of pages)', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'type' => 'checkbox', - 'priority' => 15, + 'priority' => 5, ) ); $wp_customize->add_control( 'center_content_mobile', array( 'label' => __( 'Center the content on mobile.', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'type' => 'checkbox', - 'priority' => 16, + 'priority' => 6, ) ); $wp_customize->add_control( new Decode_Customize_Slider_Control( $wp_customize, 'content_width', array( 'label' => esc_html__( 'Content Width', 'decode' ), + 'description' => esc_html__( 'Select the content width in percentage.', 'decode' ), 'choices' => array( - 'min' => 640, - 'max' => 792, - 'step' => 1 + 'min' => 41.619, + 'max' => 80, + 'step' => 0.001 ), - 'section' => 'decode_content_options', - 'priority' => 17, + 'section' => 'decode_content_options_general', + 'priority' => 7, ) ) ); $wp_customize->add_control( new Decode_Customize_Textarea_Control( $wp_customize, 'site_colophon', array( 'label' => __( 'Text (colophon, copyright, credits, etc.) for the footer of the site', 'decode' ), - 'section' => 'decode_content_options', + 'section' => 'decode_content_options_general', 'settings' => 'site_colophon', 'type' => 'textarea', - 'priority' => 18, + 'priority' => 8, ) ) ); @@ -1521,7 +1522,6 @@ public static function decode_customize_register( $wp_customize ) { $wp_customize->add_section( 'decode_other_options', array( 'title' => __( 'Other Options', 'decode' ), - 'description' => __( 'Custom CSS is longer recommended. This feature may be removed in a future update. To continue using your tweaks, copy and paste your CSS into a custom CSS plugin such as Jetpack. Get help here.', 'decode' ), 'priority' => 38, ) ); @@ -1645,7 +1645,8 @@ public static function decode_output_color_css() { ?> get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ) ); + if( $attachment ) { + return $attachment[0]; + } +} + +if( version_compare( $GLOBALS['wp_version'], '4.3', '>' ) ) { + /** + * Site Icon + */ + add_action( 'admin_init', 'decode_site_icon' ); + function decode_site_icon() { + $get_theme = wp_get_theme(); + + if( $get_theme['Version'] > '3.12.0' ) { + $favicon_image = get_theme_mod( 'favicon_image', '' ); + + if( $favicon_image && !has_site_icon() ) { + $image_id = decode_get_image_id_from_image_url( $favicon_image ); + update_option( 'site_icon', $image_id ); + } + } + } +} \ No newline at end of file diff --git a/index.php b/index.php index 0d93ce3..ff5b3f5 100644 --- a/index.php +++ b/index.php @@ -1,18 +1,17 @@ -