wp/wp-content/themes/twentythirteen/functions.php
changeset 10 372f2766ea20
parent 7 cf61fcea0001
--- a/wp/wp-content/themes/twentythirteen/functions.php	Mon Oct 14 18:28:13 2019 +0200
+++ b/wp/wp-content/themes/twentythirteen/functions.php	Mon Oct 14 18:30:03 2019 +0200
@@ -6,12 +6,13 @@
  * theme as custom template tags. Others are attached to action and filter
  * hooks in WordPress to change core functionality.
  *
- * When using a child theme (see https://codex.wordpress.org/Theme_Development
- * and https://codex.wordpress.org/Child_Themes), you can override certain
- * functions (those wrapped in a function_exists() call) by defining them first
- * in your child theme's functions.php file. The child theme's functions.php
- * file is included before the parent theme's file, so the child theme
- * functions would be used.
+ * When using a child theme you can override certain functions (those wrapped
+ * in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before
+ * the parent theme's file, so the child theme functions would be used.
+ *
+ * @link https://codex.wordpress.org/Theme_Development
+ * @link https://developer.wordpress.org/themes/advanced-topics/child-themes/
  *
  * Functions that are not pluggable (not wrapped in function_exists()) are
  * instead attached to a filter or action hook.
@@ -76,6 +77,80 @@
 	 */
 	add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url() ) );
 
+	// Load regular editor styles into the new block-based editor.
+	add_theme_support( 'editor-styles' );
+
+	// Load default block styles.
+	add_theme_support( 'wp-block-styles' );
+
+	// Add support for full and wide align images.
+	add_theme_support( 'align-wide' );
+
+	// Add support for responsive embeds.
+	add_theme_support( 'responsive-embeds' );
+
+	// Add support for custom color scheme.
+	add_theme_support(
+		'editor-color-palette',
+		array(
+			array(
+				'name'  => __( 'Dark Gray', 'twentythirteen' ),
+				'slug'  => 'dark-gray',
+				'color' => '#141412',
+			),
+			array(
+				'name'  => __( 'Red', 'twentythirteen' ),
+				'slug'  => 'red',
+				'color' => '#bc360a',
+			),
+			array(
+				'name'  => __( 'Medium Orange', 'twentythirteen' ),
+				'slug'  => 'medium-orange',
+				'color' => '#db572f',
+			),
+			array(
+				'name'  => __( 'Light Orange', 'twentythirteen' ),
+				'slug'  => 'light-orange',
+				'color' => '#ea9629',
+			),
+			array(
+				'name'  => __( 'Yellow', 'twentythirteen' ),
+				'slug'  => 'yellow',
+				'color' => '#fbca3c',
+			),
+			array(
+				'name'  => __( 'White', 'twentythirteen' ),
+				'slug'  => 'white',
+				'color' => '#fff',
+			),
+			array(
+				'name'  => __( 'Dark Brown', 'twentythirteen' ),
+				'slug'  => 'dark-brown',
+				'color' => '#220e10',
+			),
+			array(
+				'name'  => __( 'Medium Brown', 'twentythirteen' ),
+				'slug'  => 'medium-brown',
+				'color' => '#722d19',
+			),
+			array(
+				'name'  => __( 'Light Brown', 'twentythirteen' ),
+				'slug'  => 'light-brown',
+				'color' => '#eadaa6',
+			),
+			array(
+				'name'  => __( 'Beige', 'twentythirteen' ),
+				'slug'  => 'beige',
+				'color' => '#e8e5ce',
+			),
+			array(
+				'name'  => __( 'Off-white', 'twentythirteen' ),
+				'slug'  => 'off-white',
+				'color' => '#f7f5e7',
+			),
+		)
+	);
+
 	// Adds RSS feed links to <head> for posts and comments.
 	add_theme_support( 'automatic-feed-links' );
 
@@ -84,7 +159,8 @@
 	 * and comments to output valid HTML5.
 	 */
 	add_theme_support(
-		'html5', array(
+		'html5',
+		array(
 			'search-form',
 			'comment-form',
 			'comment-list',
@@ -98,7 +174,8 @@
 	 * See https://codex.wordpress.org/Post_Formats
 	 */
 	add_theme_support(
-		'post-formats', array(
+		'post-formats',
+		array(
 			'aside',
 			'audio',
 			'chat',
@@ -201,11 +278,14 @@
 	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
 
 	// Add Genericons font, used in the main stylesheet.
-	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' );
+	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' );
 
 	// Loads our main stylesheet.
 	wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' );
 
+	// Theme block stylesheet.
+	wp_enqueue_style( 'twentythirteen-block-style', get_template_directory_uri() . '/css/blocks.css', array( 'twentythirteen-style' ), '2018-12-30' );
+
 	// Loads the Internet Explorer specific stylesheet.
 	wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' );
 	wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );
@@ -238,6 +318,19 @@
 add_filter( 'wp_resource_hints', 'twentythirteen_resource_hints', 10, 2 );
 
 /**
+ * Enqueue styles for the block-based editor.
+ *
+ * @since Twenty Thirteen 2.5
+ */
+function twentythirteen_block_editor_styles() {
+	// Block styles.
+	wp_enqueue_style( 'twentythirteen-block-editor-style', get_template_directory_uri() . '/css/editor-blocks.css', array(), '2018-12-30' );
+	// Add custom fonts.
+	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
+}
+add_action( 'enqueue_block_editor_assets', 'twentythirteen_block_editor_styles' );
+
+/**
  * Filter the page title.
  *
  * Creates a nicely formatted and more specific title element text for output
@@ -334,7 +427,7 @@
 
 		</div><!-- .nav-links -->
 	</nav><!-- .navigation -->
-	<?php
+		<?php
 	}
 endif;
 
@@ -364,7 +457,7 @@
 
 		</div><!-- .nav-links -->
 	</nav><!-- .navigation -->
-	<?php
+		<?php
 	}
 endif;
 
@@ -495,8 +588,8 @@
 			// get the URL of the next image attachment...
 			if ( $next_id ) {
 				$next_attachment_url = get_attachment_link( $next_id );
-			} // or get the URL of the first image attachment.
-			else {
+			} else {
+				// or get the URL of the first image attachment.
 				$next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
 			}
 		}
@@ -611,14 +704,16 @@
 
 	if ( isset( $wp_customize->selective_refresh ) ) {
 		$wp_customize->selective_refresh->add_partial(
-			'blogname', array(
+			'blogname',
+			array(
 				'selector'            => '.site-title',
 				'container_inclusive' => false,
 				'render_callback'     => 'twentythirteen_customize_partial_blogname',
 			)
 		);
 		$wp_customize->selective_refresh->add_partial(
-			'blogdescription', array(
+			'blogdescription',
+			array(
 				'selector'            => '.site-description',
 				'container_inclusive' => false,
 				'render_callback'     => 'twentythirteen_customize_partial_blogdescription',
@@ -683,3 +778,21 @@
 	return $args;
 }
 add_filter( 'widget_tag_cloud_args', 'twentythirteen_widget_tag_cloud_args' );
+
+if ( ! function_exists( 'wp_body_open' ) ) :
+	/**
+	 * Fire the wp_body_open action.
+	 *
+	 * Added for backwards compatibility to support pre 5.2.0 WordPress versions.
+	 *
+	 * @since Twenty Thirteen 2.8
+	 */
+	function wp_body_open() {
+		/**
+		 * Triggered after the opening <body> tag.
+		 *
+		 * @since Twenty Thirteen 2.8
+		 */
+		do_action( 'wp_body_open' );
+	}
+endif;