require( get_template_directory() . '/inc/custom-header.php' );
/**
- * Enqueues scripts and styles for front-end.
+ * Returns the Google font stylesheet URL if available.
*
- * @since Twenty Twelve 1.0
+ * The use of Open Sans by default is localized. For languages that use
+ * characters not supported by the font, the font can be disabled.
+ *
+ * @since Twenty Twelve 1.2
+ *
+ * @return string Font stylesheet or empty string if disabled.
*/
-function twentytwelve_scripts_styles() {
- global $wp_styles;
-
- /*
- * Adds JavaScript to pages with the comment form to support
- * sites with threaded comments (when in use).
- */
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
- wp_enqueue_script( 'comment-reply' );
-
- /*
- * Adds JavaScript for handling the navigation menu hide-and-show behavior.
- */
- wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );
-
- /*
- * Loads our special font CSS file.
- *
- * The use of Open Sans by default is localized. For languages that use
- * characters not supported by the font, the font can be disabled.
- *
- * To disable in a child theme, use wp_dequeue_style()
- * function mytheme_dequeue_fonts() {
- * wp_dequeue_style( 'twentytwelve-fonts' );
- * }
- * add_action( 'wp_enqueue_scripts', 'mytheme_dequeue_fonts', 11 );
- */
+function twentytwelve_get_font_url() {
+ $font_url = '';
/* translators: If there are characters in your language that are not supported
- by Open Sans, translate this to 'off'. Do not translate into your own language. */
+ by Open Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'twentytwelve' ) ) {
$subsets = 'latin,latin-ext';
/* translators: To add an additional Open Sans character subset specific to your language, translate
- this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */
+ this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. */
$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve' );
if ( 'cyrillic' == $subset )
'family' => 'Open+Sans:400italic,700italic,400,700',
'subset' => $subsets,
);
- wp_enqueue_style( 'twentytwelve-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ), array(), null );
+ $font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
}
+ return $font_url;
+}
+
+/**
+ * Enqueues scripts and styles for front-end.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_scripts_styles() {
+ global $wp_styles;
+
+ /*
+ * Adds JavaScript to pages with the comment form to support
+ * sites with threaded comments (when in use).
+ */
+ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
+ wp_enqueue_script( 'comment-reply' );
+
+ /*
+ * Adds JavaScript for handling the navigation menu hide-and-show behavior.
+ */
+ wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );
+
+ $font_url = twentytwelve_get_font_url();
+ if ( ! empty( $font_url ) )
+ wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null );
+
/*
* Loads our main stylesheet.
*/
}
add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
+/**
+ * Adds additional stylesheets to the TinyMCE editor if needed.
+ *
+ * @uses twentytwelve_get_font_url() To get the Google Font stylesheet URL.
+ *
+ * @since Twenty Twelve 1.2
+ *
+ * @param string $mce_css CSS path to load in TinyMCE.
+ * @return string
+ */
+function twentytwelve_mce_css( $mce_css ) {
+ $font_url = twentytwelve_get_font_url();
+
+ if ( empty( $font_url ) )
+ return $mce_css;
+
+ if ( ! empty( $mce_css ) )
+ $mce_css .= ',';
+
+ $mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) );
+
+ return $mce_css;
+}
+add_filter( 'mce_css', 'twentytwelve_mce_css' );
+
/**
* Creates a nicely formatted and more specific title element text
* for output in head of document, based on current view.
if ( $wp_query->max_num_pages > 1 ) : ?>
<nav id="<?php echo $html_id; ?>" class="navigation" role="navigation">
<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
- <div class="nav-previous alignleft"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentytwelve' ) ); ?></div>
- <div class="nav-next alignright"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?></div>
+ <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentytwelve' ) ); ?></div>
+ <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?></div>
</nav><!-- #<?php echo $html_id; ?> .navigation -->
<?php endif;
}
<header class="comment-meta comment-author vcard">
<?php
echo get_avatar( $comment, 44 );
- printf( '<cite class="fn">%1$s %2$s</cite>',
+ printf( '<cite><b class="fn">%1$s</b> %2$s</cite>',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
- ( $comment->user_id === $post->post_author ) ? '<span> ' . __( 'Post author', 'twentytwelve' ) . '</span>' : ''
+ ( $comment->user_id === $post->post_author ) ? '<span>' . __( 'Post author', 'twentytwelve' ) . '</span>' : ''
);
printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
esc_url( get_comment_link( $comment->comment_ID ) ),
*/
function twentytwelve_body_class( $classes ) {
$background_color = get_background_color();
+ $background_image = get_background_image();
if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) )
$classes[] = 'full-width';
$classes[] = 'two-sidebars';
}
- if ( empty( $background_color ) )
- $classes[] = 'custom-background-empty';
- elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
- $classes[] = 'custom-background-white';
+ if ( empty( $background_image ) ) {
+ if ( empty( $background_color ) )
+ $classes[] = 'custom-background-empty';
+ elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
+ $classes[] = 'custom-background-white';
+ }
// Enable custom font class only if the font CSS is queued to load.
if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) )
* @return void
*/
function twentytwelve_customize_register( $wp_customize ) {
- $wp_customize->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';
}
add_action( 'customize_register', 'twentytwelve_customize_register' );
* @since Twenty Twelve 1.0
*/
function twentytwelve_customize_preview_js() {
- wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120827', true );
+ wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20130301', true );
}
add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );