themes/ 0000755 0003125 0003125 00000000000 12654410627 012450 5 ustar eacbforg eacbforg themes/twentyfifteen/ 0000755 0003125 0003125 00000000000 12654411246 015341 5 ustar eacbforg eacbforg themes/twentyfifteen/inc/ 0000755 0003125 0003125 00000000000 12654410420 016103 5 ustar eacbforg eacbforg themes/twentyfifteen/inc/template-tags.php 0000644 0003125 0003125 00000017460 12637346060 021404 0 ustar eacbforg eacbforg 1 && get_option( 'page_comments' ) ) : ?> %s', __( 'Featured', 'twentyfifteen' ) ); } $format = get_post_format(); if ( current_theme_supports( 'post-formats', $format ) ) { printf( '%1$s%3$s', sprintf( '%s ', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ), esc_url( get_post_format_link( $format ) ), get_post_format_string( $format ) ); } if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) { $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), get_the_date(), esc_attr( get_the_modified_date( 'c' ) ), get_the_modified_date() ); printf( '%1$s %3$s', _x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ), esc_url( get_permalink() ), $time_string ); } if ( 'post' == get_post_type() ) { if ( is_singular() || is_multi_author() ) { printf( '', _x( 'Author', 'Used before post author name.', 'twentyfifteen' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), get_the_author() ); } $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); if ( $categories_list && twentyfifteen_categorized_blog() ) { printf( '%1$s %2$s', _x( 'Categories', 'Used before category names.', 'twentyfifteen' ), $categories_list ); } $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) ); if ( $tags_list ) { printf( '', _x( 'Tags', 'Used before tag names.', 'twentyfifteen' ), $tags_list ); } } if ( is_attachment() && wp_attachment_is_image() ) { // Retrieve attachment metadata. $metadata = wp_get_attachment_metadata(); printf( '%1$s %3$s × %4$s', _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ), esc_url( wp_get_attachment_url() ), $metadata['width'], $metadata['height'] ); } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; /* translators: %s: post title */ comments_popup_link( sprintf( __( 'Leave a comment on %s', 'twentyfifteen' ), get_the_title() ) ); echo ''; } } endif; /** * Determine whether blog/site has more than one category. * * @since Twenty Fifteen 1.0 * * @return bool True of there is more than one category, false otherwise. */ function twentyfifteen_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( 'fields' => 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, ) ); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'twentyfifteen_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so twentyfifteen_categorized_blog should return true. return true; } else { // This blog has only 1 category so twentyfifteen_categorized_blog should return false. return false; } } /** * Flush out the transients used in {@see twentyfifteen_categorized_blog()}. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'twentyfifteen_categories' ); } add_action( 'edit_category', 'twentyfifteen_category_transient_flusher' ); add_action( 'save_post', 'twentyfifteen_category_transient_flusher' ); if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) : /** * Display an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?>
%s
', $message ); } /** * Prevent the Customizer from being loaded on WordPress versions prior to 4.1. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_customize() { wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), '', array( 'back_link' => true, ) ); } add_action( 'load-customize.php', 'twentyfifteen_customize' ); /** * Prevent the Theme Preview from being loaded on WordPress versions prior to 4.1. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_preview() { if ( isset( $_GET['preview'] ) ) { wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ) ); } } add_action( 'template_redirect', 'twentyfifteen_preview' ); themes/twentyfifteen/inc/custom-header.php 0000644 0003125 0003125 00000022327 12637346060 021373 0 ustar eacbforg eacbforg $default_text_color, 'width' => 954, 'height' => 1300, 'wp-head-callback' => 'twentyfifteen_header_style', ) ) ); } add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' ); /** * Convert HEX to RGB. * * @since Twenty Fifteen 1.0 * * @param string $color The original color, in 3- or 6-digit hexadecimal form. * @return array Array containing RGB (red, green, and blue) values for the given * HEX code, empty array otherwise. */ function twentyfifteen_hex2rgb( $color ) { $color = trim( $color, '#' ); if ( strlen( $color ) == 3 ) { $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) ); $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) ); $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) ); } else if ( strlen( $color ) == 6 ) { $r = hexdec( substr( $color, 0, 2 ) ); $g = hexdec( substr( $color, 2, 2 ) ); $b = hexdec( substr( $color, 4, 2 ) ); } else { return array(); } return array( 'red' => $r, 'green' => $g, 'blue' => $b ); } if ( ! function_exists( 'twentyfifteen_header_style' ) ) : /** * Styles the header image and text displayed on the blog. * * @since Twenty Fifteen 1.0 * * @see twentyfifteen_custom_header_setup() */ function twentyfifteen_header_style() { $header_image = get_header_image(); // If no custom options for text are set, let's bail. if ( empty( $header_image ) && display_header_text() ) { return; } // If we get this far, we have custom styles. Let's do this. ?> get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; // Add color scheme setting and control. $wp_customize->add_setting( 'color_scheme', array( 'default' => 'default', 'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme', 'transport' => 'postMessage', ) ); $wp_customize->add_control( 'color_scheme', array( 'label' => __( 'Base Color Scheme', 'twentyfifteen' ), 'section' => 'colors', 'type' => 'select', 'choices' => twentyfifteen_get_color_scheme_choices(), 'priority' => 1, ) ); // Add custom header and sidebar text color setting and control. $wp_customize->add_setting( 'sidebar_textcolor', array( 'default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( 'label' => __( 'Header and Sidebar Text Color', 'twentyfifteen' ), 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), 'section' => 'colors', ) ) ); // Remove the core header textcolor control, as it shares the sidebar text color. $wp_customize->remove_control( 'header_textcolor' ); // Add custom header and sidebar background color setting and control. $wp_customize->add_setting( 'header_background_color', array( 'default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', 'transport' => 'postMessage', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( 'label' => __( 'Header and Sidebar Background Color', 'twentyfifteen' ), 'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ), 'section' => 'colors', ) ) ); // Add an additional description to the header image section. $wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ); } add_action( 'customize_register', 'twentyfifteen_customize_register', 11 ); /** * Register color schemes for Twenty Fifteen. * * Can be filtered with {@see 'twentyfifteen_color_schemes'}. * * The order of colors in a colors array: * 1. Main Background Color. * 2. Sidebar Background Color. * 3. Box Background Color. * 4. Main Text and Link Color. * 5. Sidebar Text and Link Color. * 6. Meta Box Background Color. * * @since Twenty Fifteen 1.0 * * @return array An associative array of color scheme options. */ function twentyfifteen_get_color_schemes() { /** * Filter the color schemes registered for use with Twenty Fifteen. * * The default schemes include 'default', 'dark', 'yellow', 'pink', 'purple', and 'blue'. * * @since Twenty Fifteen 1.0 * * @param array $schemes { * Associative array of color schemes data. * * @type array $slug { * Associative array of information for setting up the color scheme. * * @type string $label Color scheme label. * @type array $colors HEX codes for default colors prepended with a hash symbol ('#'). * Colors are defined in the following order: Main background, sidebar * background, box background, main text and link, sidebar text and link, * meta box background. * } * } */ return apply_filters( 'twentyfifteen_color_schemes', array( 'default' => array( 'label' => __( 'Default', 'twentyfifteen' ), 'colors' => array( '#f1f1f1', '#ffffff', '#ffffff', '#333333', '#333333', '#f7f7f7', ), ), 'dark' => array( 'label' => __( 'Dark', 'twentyfifteen' ), 'colors' => array( '#111111', '#202020', '#202020', '#bebebe', '#bebebe', '#1b1b1b', ), ), 'yellow' => array( 'label' => __( 'Yellow', 'twentyfifteen' ), 'colors' => array( '#f4ca16', '#ffdf00', '#ffffff', '#111111', '#111111', '#f1f1f1', ), ), 'pink' => array( 'label' => __( 'Pink', 'twentyfifteen' ), 'colors' => array( '#ffe5d1', '#e53b51', '#ffffff', '#352712', '#ffffff', '#f1f1f1', ), ), 'purple' => array( 'label' => __( 'Purple', 'twentyfifteen' ), 'colors' => array( '#674970', '#2e2256', '#ffffff', '#2e2256', '#ffffff', '#f1f1f1', ), ), 'blue' => array( 'label' => __( 'Blue', 'twentyfifteen' ), 'colors' => array( '#e9f2f9', '#55c3dc', '#ffffff', '#22313f', '#ffffff', '#f1f1f1', ), ), ) ); } if ( ! function_exists( 'twentyfifteen_get_color_scheme' ) ) : /** * Get the current Twenty Fifteen color scheme. * * @since Twenty Fifteen 1.0 * * @return array An associative array of either the current or default color scheme hex values. */ function twentyfifteen_get_color_scheme() { $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); $color_schemes = twentyfifteen_get_color_schemes(); if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { return $color_schemes[ $color_scheme_option ]['colors']; } return $color_schemes['default']['colors']; } endif; // twentyfifteen_get_color_scheme if ( ! function_exists( 'twentyfifteen_get_color_scheme_choices' ) ) : /** * Returns an array of color scheme choices registered for Twenty Fifteen. * * @since Twenty Fifteen 1.0 * * @return array Array of color schemes. */ function twentyfifteen_get_color_scheme_choices() { $color_schemes = twentyfifteen_get_color_schemes(); $color_scheme_control_options = array(); foreach ( $color_schemes as $color_scheme => $value ) { $color_scheme_control_options[ $color_scheme ] = $value['label']; } return $color_scheme_control_options; } endif; // twentyfifteen_get_color_scheme_choices if ( ! function_exists( 'twentyfifteen_sanitize_color_scheme' ) ) : /** * Sanitization callback for color schemes. * * @since Twenty Fifteen 1.0 * * @param string $value Color scheme name value. * @return string Color scheme name. */ function twentyfifteen_sanitize_color_scheme( $value ) { $color_schemes = twentyfifteen_get_color_scheme_choices(); if ( ! array_key_exists( $value, $color_schemes ) ) { $value = 'default'; } return $value; } endif; // twentyfifteen_sanitize_color_scheme /** * Enqueues front-end CSS for color scheme. * * @since Twenty Fifteen 1.0 * * @see wp_add_inline_style() */ function twentyfifteen_color_scheme_css() { $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); // Don't do anything if the default color scheme is selected. if ( 'default' === $color_scheme_option ) { return; } $color_scheme = twentyfifteen_get_color_scheme(); // Convert main and sidebar text hex color to rgba. $color_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[3] ); $color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] ); $colors = array( 'background_color' => $color_scheme[0], 'header_background_color' => $color_scheme[1], 'box_background_color' => $color_scheme[2], 'textcolor' => $color_scheme[3], 'secondary_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ), 'border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ), 'border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ), 'sidebar_textcolor' => $color_scheme[4], 'sidebar_border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ), 'sidebar_border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ), 'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ), 'meta_box_background_color' => $color_scheme[5], ); $color_scheme_css = twentyfifteen_get_color_scheme_css( $colors ); wp_add_inline_style( 'twentyfifteen-style', $color_scheme_css ); } add_action( 'wp_enqueue_scripts', 'twentyfifteen_color_scheme_css' ); /** * Binds JS listener to make Customizer color_scheme control. * * Passes color scheme data as colorScheme global. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_customize_control_js() { wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true ); wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() ); } add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' ); /** * Binds JS handlers to make the Customizer preview reload changes asynchronously. * * @since Twenty Fifteen 1.0 */ function twentyfifteen_customize_preview_js() { wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true ); } add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' ); /** * Returns CSS for the color schemes. * * @since Twenty Fifteen 1.0 * * @param array $colors Color scheme colors. * @return string Color scheme CSS. */ function twentyfifteen_get_color_scheme_css( $colors ) { $colors = wp_parse_args( $colors, array( 'background_color' => '', 'header_background_color' => '', 'box_background_color' => '', 'textcolor' => '', 'secondary_textcolor' => '', 'border_color' => '', 'border_focus_color' => '', 'sidebar_textcolor' => '', 'sidebar_border_color' => '', 'sidebar_border_focus_color' => '', 'secondary_sidebar_textcolor' => '', 'meta_box_background_color' => '', ) ); $css = <<