From 2e61bda37ea8940080e38385f909337832ac421f Mon Sep 17 00:00:00 2001 From: Holger Koenemann Date: Fri, 13 Mar 2015 15:46:51 +0100 Subject: [PATCH] Submitting Prechecks Prechecks for submitting theme to wordpress.org --- comments.php | 9 ++++-- inc/customizer.php | 14 ++++++--- inc/extras.php | 74 +++++++++++++++++++++++++++------------------- single.php | 5 ++-- style.css | 18 +++++++++-- 5 files changed, 77 insertions(+), 43 deletions(-) diff --git a/comments.php b/comments.php index 103c0a7..a89d6b9 100644 --- a/comments.php +++ b/comments.php @@ -64,9 +64,12 @@ if ( post_password_required() ) {

- + + diff --git a/inc/customizer.php b/inc/customizer.php index 629bb77..951ecef 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -25,7 +25,8 @@ function understrap_theme_customize_register( $wp_customize ) { ) ); $wp_customize->add_setting( 'understrap_theme_slider_count_setting', array( - 'default' => '1' + 'default' => '1', + 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'understrap_theme_slider_count', array( @@ -36,7 +37,8 @@ function understrap_theme_customize_register( $wp_customize ) { ) ); $wp_customize->add_setting( 'understrap_theme_slider_time_setting', array( - 'default' => '5000' + 'default' => '5000', + 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'understrap_theme_slider_time', array( @@ -47,7 +49,8 @@ function understrap_theme_customize_register( $wp_customize ) { ) ); $wp_customize->add_setting( 'understrap_theme_slider_loop_setting', array( - 'default' => 'true' + 'default' => 'true', + 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'understrap_theme_loop', array( @@ -66,7 +69,8 @@ function understrap_theme_customize_register( $wp_customize ) { ) ); $wp_customize->add_setting( 'understrap_theme_script_code_setting', array( - 'default' => '' + 'default' => '', + 'sanitize_callback' => 'esc_textarea' ) ); $wp_customize->add_control( 'understrap_theme_script_code', array( @@ -78,6 +82,8 @@ function understrap_theme_customize_register( $wp_customize ) { } add_action( 'customize_register', 'understrap_theme_customize_register' ); + + /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ diff --git a/inc/extras.php b/inc/extras.php index b48132f..556b321 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -35,38 +35,47 @@ function understrap_body_classes( $classes ) { } add_filter( 'body_class', 'understrap_body_classes' ); -if ( ! function_exists( '_wp_render_title_tag' ) ) : - /** - * Filters wp_title to print a neat tag based on what is being viewed. - * - * @param string $title Default title text for current view. - * @param string $sep Optional separator. - * @return string The filtered title. - */ - function understrap_wp_title( $title, $sep ) { - if ( is_feed() ) { - return $title; - } +if ( version_compare( $GLOBALS['wp_version'], '4.1', '<' ) ) : + /** + * Filters wp_title to print a neat <title> tag based on what is being viewed. + * + * @param string $title Default title text for current view. + * @param string $sep Optional separator. + * @return string The filtered title. + */ + function understrap_wp_title( $title, $sep ) { + if ( is_feed() ) { + return $title; + } + global $page, $paged; +// Add the blog name + $title .= get_bloginfo( 'name', 'display' ); +// Add the blog description for the home/front page. + $site_description = get_bloginfo( 'description', 'display' ); + if ( $site_description && ( is_home() || is_front_page() ) ) { + $title .= " $sep $site_description"; + } +// Add a page number if necessary: + if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { + $title .= " $sep " . sprintf( __( 'Page %s', 'understrap' ), max( $paged, $page ) ); + } + return $title; + } + add_filter( 'wp_title', 'understrap_wp_title', 10, 2 ); + /** + * Title shim for sites older than WordPress 4.1. + * + * @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ + * @todo Remove this function when WordPress 4.3 is released. + */ + function understrap_render_title() { - global $page, $paged; + ?> + <title><?php wp_title( '|', true, 'right' ); ?> + = 2 || $page >= 2 ) && ! is_404() ) { - $title .= " $sep " . sprintf( __( 'Page %s', 'understrap' ), max( $paged, $page ) ); - } - - return $title; - } - add_filter( 'wp_title', 'understrap_wp_title', 10, 2 ); endif; if ( ! function_exists( '_wp_render_title_tag' ) ) : @@ -76,8 +85,11 @@ if ( ! function_exists( '_wp_render_title_tag' ) ) : * @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ * @todo Remove this function when WordPress 4.3 is released. */ + function understrap_render_title() { - echo '' . wp_title( '|', false, 'right' ) . "\n"; + ?> + <?php wp_title( '|', true, 'right' ); ?> + - - + ?>**/ diff --git a/style.css b/style.css index 4b6ee8e..043ef90 100644 --- a/style.css +++ b/style.css @@ -4,13 +4,27 @@ Theme URI: http://holgerkoenemann.de/understrap Author: Holger Koenemann Author URI: http://www.holgerkoenemann.de Description: Combination of AutomatticĀ“s _s theme and Bootstrap SASS -Version: 0.2.8 +Version: 0.2.9 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: understrap -Details URI: http://example.com/my-theme-changelog.html +Tags: light, red, white, one-column, responsive-layout, custom-header, custom-menu, featured-images, flexible-header, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready + +This theme, like WordPress, is licensed under the GPL. +UnderStrap is based on Underscores http://underscores.me/, (C) 2012-2014 Automattic, Inc. + +Resource Licenses: +Font Awesome: http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) +Bootstrap: http://getbootstrap.com | https://github.com/twbs/bootstrap/blob/master/LICENSE (Code licensed under MIT, documentation under CC BY 3.0.) +Owl Carousel 2: http://www.owlcarousel.owlgraphic.com/ | https://github.com/smashingboxes/OwlCarousel2/blob/develop/LICENSE (Code licensed under MIT) +Portions of Jasnys Bootstrap "missing components": http://jasny.github.io/bootstrap/ (released under the Apache 2.0 license) +and of course +jQuery: https://jquery.org | (Code licensed under MIT) + */ /*This file is just used to identify the theme in wordpress. The compiles CSS output can be found in /css/theme.css The SASS sources for it can be found in this folder: /sass/ + +...and no go out and play! */