wp/wp-content/themes/twentyfourteen/inc/featured-content.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     6  * in the theme's Featured Content area.
     6  * in the theme's Featured Content area.
     7  *
     7  *
     8  * For maximum compatibility with different methods of posting users
     8  * For maximum compatibility with different methods of posting users
     9  * will designate a featured post tag to associate posts with. Since
     9  * will designate a featured post tag to associate posts with. Since
    10  * this tag now has special meaning beyond that of a normal tags, users
    10  * this tag now has special meaning beyond that of a normal tags, users
    11  * will have the ability to hide it from the front-end of their site.
    11  * will have the ability to hide it from the front end of their site.
    12  */
    12  */
    13 class Featured_Content {
    13 class Featured_Content {
    14 
    14 
    15 	/**
    15 	/**
    16 	 * The maximum number of posts a Featured Content area can contain.
    16 	 * The maximum number of posts a Featured Content area can contain.
    21 	 *
    21 	 *
    22 	 * @see Featured_Content::init()
    22 	 * @see Featured_Content::init()
    23 	 *
    23 	 *
    24 	 * @since Twenty Fourteen 1.0
    24 	 * @since Twenty Fourteen 1.0
    25 	 *
    25 	 *
    26 	 * @static
       
    27 	 * @access public
       
    28 	 * @var int
    26 	 * @var int
    29 	 */
    27 	 */
    30 	public static $max_posts = 15;
    28 	public static $max_posts = 15;
    31 
    29 
    32 	/**
    30 	/**
    33 	 * Instantiate.
    31 	 * Instantiate.
    34 	 *
    32 	 *
    35 	 * All custom functionality will be hooked into the "init" action.
    33 	 * All custom functionality will be hooked into the "init" action.
    36 	 *
    34 	 *
    37 	 * @static
       
    38 	 * @access public
       
    39 	 * @since Twenty Fourteen 1.0
    35 	 * @since Twenty Fourteen 1.0
    40 	 */
    36 	 */
    41 	public static function setup() {
    37 	public static function setup() {
    42 		add_action( 'init', array( __CLASS__, 'init' ), 30 );
    38 		add_action( 'init', array( __CLASS__, 'init' ), 30 );
    43 	}
    39 	}
    49 	 * add_theme_support( 'featured-content' ); during after_setup_theme.
    45 	 * add_theme_support( 'featured-content' ); during after_setup_theme.
    50 	 *
    46 	 *
    51 	 * If no theme support is found there is no need to hook into WordPress.
    47 	 * If no theme support is found there is no need to hook into WordPress.
    52 	 * We'll just return early instead.
    48 	 * We'll just return early instead.
    53 	 *
    49 	 *
    54 	 * @static
       
    55 	 * @access public
       
    56 	 * @since Twenty Fourteen 1.0
    50 	 * @since Twenty Fourteen 1.0
    57 	 */
    51 	 */
    58 	public static function init() {
    52 	public static function init() {
    59 		$theme_support = get_theme_support( 'featured-content' );
    53 		$theme_support = get_theme_support( 'featured-content' );
    60 
    54 
    81 		// Theme can override the number of max posts.
    75 		// Theme can override the number of max posts.
    82 		if ( isset( $theme_support[0]['max_posts'] ) ) {
    76 		if ( isset( $theme_support[0]['max_posts'] ) ) {
    83 			self::$max_posts = absint( $theme_support[0]['max_posts'] );
    77 			self::$max_posts = absint( $theme_support[0]['max_posts'] );
    84 		}
    78 		}
    85 
    79 
    86 		add_filter( $filter,                              array( __CLASS__, 'get_featured_posts' )    );
    80 		add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) );
    87 		add_action( 'customize_register',                 array( __CLASS__, 'customize_register' ), 9 );
    81 		add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 );
    88 		add_action( 'admin_init',                         array( __CLASS__, 'register_setting'   )    );
    82 		add_action( 'admin_init', array( __CLASS__, 'register_setting' ) );
    89 		add_action( 'switch_theme',                       array( __CLASS__, 'delete_transient'   )    );
    83 		add_action( 'switch_theme', array( __CLASS__, 'delete_transient' ) );
    90 		add_action( 'save_post',                          array( __CLASS__, 'delete_transient'   )    );
    84 		add_action( 'save_post', array( __CLASS__, 'delete_transient' ) );
    91 		add_action( 'delete_post_tag',                    array( __CLASS__, 'delete_post_tag'    )    );
    85 		add_action( 'delete_post_tag', array( __CLASS__, 'delete_post_tag' ) );
    92 		add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts'    )    );
    86 		add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
    93 		add_action( 'pre_get_posts',                      array( __CLASS__, 'pre_get_posts'      )    );
    87 		add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) );
    94 		add_action( 'wp_loaded',                          array( __CLASS__, 'wp_loaded'          )    );
    88 		add_action( 'wp_loaded', array( __CLASS__, 'wp_loaded' ) );
    95 	}
    89 	}
    96 
    90 
    97 	/**
    91 	/**
    98 	 * Hide "featured" tag from the front-end.
    92 	 * Hide "featured" tag from the front end.
    99 	 *
    93 	 *
   100 	 * Has to run on wp_loaded so that the preview filters of the Customizer
    94 	 * Has to run on wp_loaded so that the preview filters of the Customizer
   101 	 * have a chance to alter the value.
    95 	 * have a chance to alter the value.
   102 	 *
    96 	 *
   103 	 * @static
       
   104 	 * @access public
       
   105 	 * @since Twenty Fourteen 1.0
    97 	 * @since Twenty Fourteen 1.0
   106 	 */
    98 	 */
   107 	public static function wp_loaded() {
    99 	public static function wp_loaded() {
   108 		if ( self::get_setting( 'hide-tag' ) ) {
   100 		if ( self::get_setting( 'hide-tag' ) ) {
   109 			add_filter( 'get_terms',     array( __CLASS__, 'hide_featured_term'     ), 10, 3 );
   101 			add_filter( 'get_terms', array( __CLASS__, 'hide_featured_term' ), 10, 3 );
   110 			add_filter( 'get_the_terms', array( __CLASS__, 'hide_the_featured_term' ), 10, 3 );
   102 			add_filter( 'get_the_terms', array( __CLASS__, 'hide_the_featured_term' ), 10, 3 );
   111 		}
   103 		}
   112 	}
   104 	}
   113 
   105 
   114 	/**
   106 	/**
   115 	 * Get featured posts.
   107 	 * Get featured posts.
   116 	 *
   108 	 *
   117 	 * @static
       
   118 	 * @access public
       
   119 	 * @since Twenty Fourteen 1.0
   109 	 * @since Twenty Fourteen 1.0
   120 	 *
   110 	 *
   121 	 * @return array Array of featured posts.
   111 	 * @return array Array of featured posts.
   122 	 */
   112 	 */
   123 	public static function get_featured_posts() {
   113 	public static function get_featured_posts() {
   126 		// No need to query if there is are no featured posts.
   116 		// No need to query if there is are no featured posts.
   127 		if ( empty( $post_ids ) ) {
   117 		if ( empty( $post_ids ) ) {
   128 			return array();
   118 			return array();
   129 		}
   119 		}
   130 
   120 
   131 		$featured_posts = get_posts( array(
   121 		$featured_posts = get_posts(
   132 			'include'        => $post_ids,
   122 			array(
   133 			'posts_per_page' => count( $post_ids ),
   123 				'include'        => $post_ids,
   134 		) );
   124 				'posts_per_page' => count( $post_ids ),
       
   125 			)
       
   126 		);
   135 
   127 
   136 		return $featured_posts;
   128 		return $featured_posts;
   137 	}
   129 	}
   138 
   130 
   139 	/**
   131 	/**
   142 	 * This function will return the an array containing the
   134 	 * This function will return the an array containing the
   143 	 * post IDs of all featured posts.
   135 	 * post IDs of all featured posts.
   144 	 *
   136 	 *
   145 	 * Sets the "featured_content_ids" transient.
   137 	 * Sets the "featured_content_ids" transient.
   146 	 *
   138 	 *
   147 	 * @static
       
   148 	 * @access public
       
   149 	 * @since Twenty Fourteen 1.0
   139 	 * @since Twenty Fourteen 1.0
   150 	 *
   140 	 *
   151 	 * @return array Array of post IDs.
   141 	 * @return array Array of post IDs.
   152 	 */
   142 	 */
   153 	public static function get_featured_post_ids() {
   143 	public static function get_featured_post_ids() {
   158 			$settings = self::get_setting();
   148 			$settings = self::get_setting();
   159 			$term     = get_term_by( 'name', $settings['tag-name'], 'post_tag' );
   149 			$term     = get_term_by( 'name', $settings['tag-name'], 'post_tag' );
   160 
   150 
   161 			if ( $term ) {
   151 			if ( $term ) {
   162 				// Query for featured posts.
   152 				// Query for featured posts.
   163 				$featured_ids = get_posts( array(
   153 				$featured_ids = get_posts(
   164 					'fields'           => 'ids',
   154 					array(
   165 					'numberposts'      => self::$max_posts,
   155 						'fields'           => 'ids',
   166 					'suppress_filters' => false,
   156 						'numberposts'      => self::$max_posts,
   167 					'tax_query'        => array(
   157 						'suppress_filters' => false,
   168 						array(
   158 						'tax_query'        => array(
   169 							'field'    => 'term_id',
   159 							array(
   170 							'taxonomy' => 'post_tag',
   160 								'field'    => 'term_id',
   171 							'terms'    => $term->term_id,
   161 								'taxonomy' => 'post_tag',
       
   162 								'terms'    => $term->term_id,
       
   163 							),
   172 						),
   164 						),
   173 					),
   165 					)
   174 				) );
   166 				);
   175 			}
   167 			}
   176 
   168 
   177 			// Get sticky posts if no Featured Content exists.
   169 			// Get sticky posts if no Featured Content exists.
   178 			if ( ! $featured_ids ) {
   170 			if ( ! $featured_ids ) {
   179 				$featured_ids = self::get_sticky_posts();
   171 				$featured_ids = self::get_sticky_posts();
   187 	}
   179 	}
   188 
   180 
   189 	/**
   181 	/**
   190 	 * Return an array with IDs of posts maked as sticky.
   182 	 * Return an array with IDs of posts maked as sticky.
   191 	 *
   183 	 *
   192 	 * @static
       
   193 	 * @access public
       
   194 	 * @since Twenty Fourteen 1.0
   184 	 * @since Twenty Fourteen 1.0
   195 	 *
   185 	 *
   196 	 * @return array Array of sticky posts.
   186 	 * @return array Array of sticky posts.
   197 	 */
   187 	 */
   198 	public static function get_sticky_posts() {
   188 	public static function get_sticky_posts() {
   204 	 *
   194 	 *
   205 	 * Hooks in the "save_post" action.
   195 	 * Hooks in the "save_post" action.
   206 	 *
   196 	 *
   207 	 * @see Featured_Content::validate_settings().
   197 	 * @see Featured_Content::validate_settings().
   208 	 *
   198 	 *
   209 	 * @static
       
   210 	 * @access public
       
   211 	 * @since Twenty Fourteen 1.0
   199 	 * @since Twenty Fourteen 1.0
   212 	 */
   200 	 */
   213 	public static function delete_transient() {
   201 	public static function delete_transient() {
   214 		delete_transient( 'featured_content_ids' );
   202 		delete_transient( 'featured_content_ids' );
   215 	}
   203 	}
   219 	 *
   207 	 *
   220 	 * Filter the home page posts, and remove any featured post ID's from it.
   208 	 * Filter the home page posts, and remove any featured post ID's from it.
   221 	 * Hooked onto the 'pre_get_posts' action, this changes the parameters of
   209 	 * Hooked onto the 'pre_get_posts' action, this changes the parameters of
   222 	 * the query before it gets any posts.
   210 	 * the query before it gets any posts.
   223 	 *
   211 	 *
   224 	 * @static
       
   225 	 * @access public
       
   226 	 * @since Twenty Fourteen 1.0
   212 	 * @since Twenty Fourteen 1.0
   227 	 *
   213 	 *
   228 	 * @param WP_Query $query WP_Query object.
   214 	 * @param WP_Query $query WP_Query object.
   229 	 * @return WP_Query Possibly-modified WP_Query.
   215 	 * @return WP_Query Possibly-modified WP_Query.
   230 	 */
   216 	 */
   267 	 *
   253 	 *
   268 	 * Hooks in the "delete_post_tag" action.
   254 	 * Hooks in the "delete_post_tag" action.
   269 	 *
   255 	 *
   270 	 * @see Featured_Content::validate_settings().
   256 	 * @see Featured_Content::validate_settings().
   271 	 *
   257 	 *
   272 	 * @static
       
   273 	 * @access public
       
   274 	 * @since Twenty Fourteen 1.0
   258 	 * @since Twenty Fourteen 1.0
   275 	 *
   259 	 *
   276 	 * @param int $tag_id The term_id of the tag that has been deleted.
   260 	 * @param int $tag_id The term_id of the tag that has been deleted.
   277 	 */
   261 	 */
   278 	public static function delete_post_tag( $tag_id ) {
   262 	public static function delete_post_tag( $tag_id ) {
   281 		if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
   265 		if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
   282 			return;
   266 			return;
   283 		}
   267 		}
   284 
   268 
   285 		$settings['tag-id'] = 0;
   269 		$settings['tag-id'] = 0;
   286 		$settings = self::validate_settings( $settings );
   270 		$settings           = self::validate_settings( $settings );
   287 		update_option( 'featured-content', $settings );
   271 		update_option( 'featured-content', $settings );
   288 	}
   272 	}
   289 
   273 
   290 	/**
   274 	/**
   291 	 * Hide featured tag from displaying when global terms are queried from the front-end.
   275 	 * Hide featured tag from displaying when global terms are queried from the front end.
   292 	 *
   276 	 *
   293 	 * Hooks into the "get_terms" filter.
   277 	 * Hooks into the "get_terms" filter.
   294 	 *
   278 	 *
   295 	 * @static
       
   296 	 * @access public
       
   297 	 * @since Twenty Fourteen 1.0
   279 	 * @since Twenty Fourteen 1.0
   298 	 *
   280 	 *
   299 	 * @param array $terms      List of term objects. This is the return value of get_terms().
   281 	 * @param array $terms      List of term objects. This is the return value of get_terms().
   300 	 * @param array $taxonomies An array of taxonomy slugs.
   282 	 * @param array $taxonomies An array of taxonomy slugs.
   301 	 * @return array A filtered array of terms.
   283 	 * @return array A filtered array of terms.
   302 	 *
   284 	 *
   303 	 * @uses Featured_Content::get_setting()
   285 	 * @uses Featured_Content::get_setting()
   304 	 */
   286 	 */
   305 	public static function hide_featured_term( $terms, $taxonomies, $args ) {
   287 	public static function hide_featured_term( $terms, $taxonomies, $args ) {
   306 
   288 
   307 		// This filter is only appropriate on the front-end.
   289 		// This filter is only appropriate on the front end.
   308 		if ( is_admin() ) {
   290 		if ( is_admin() ) {
   309 			return $terms;
   291 			return $terms;
   310 		}
   292 		}
   311 
   293 
   312 		// We only want to hide the featured tag.
   294 		// We only want to hide the featured tag.
   334 		return $terms;
   316 		return $terms;
   335 	}
   317 	}
   336 
   318 
   337 	/**
   319 	/**
   338 	 * Hide featured tag from display when terms associated with a post object
   320 	 * Hide featured tag from display when terms associated with a post object
   339 	 * are queried from the front-end.
   321 	 * are queried from the front end.
   340 	 *
   322 	 *
   341 	 * Hooks into the "get_the_terms" filter.
   323 	 * Hooks into the "get_the_terms" filter.
   342 	 *
   324 	 *
   343 	 * @static
       
   344 	 * @access public
       
   345 	 * @since Twenty Fourteen 1.0
   325 	 * @since Twenty Fourteen 1.0
   346 	 *
   326 	 *
   347 	 * @param array $terms    A list of term objects. This is the return value of get_the_terms().
   327 	 * @param array $terms    A list of term objects. This is the return value of get_the_terms().
   348 	 * @param int   $id       The ID field for the post object that terms are associated with.
   328 	 * @param int   $id       The ID field for the post object that terms are associated with.
   349 	 * @param array $taxonomy An array of taxonomy slugs.
   329 	 * @param array $taxonomy An array of taxonomy slugs.
   351 	 *
   331 	 *
   352 	 * @uses Featured_Content::get_setting()
   332 	 * @uses Featured_Content::get_setting()
   353 	 */
   333 	 */
   354 	public static function hide_the_featured_term( $terms, $id, $taxonomy ) {
   334 	public static function hide_the_featured_term( $terms, $id, $taxonomy ) {
   355 
   335 
   356 		// This filter is only appropriate on the front-end.
   336 		// This filter is only appropriate on the front end.
   357 		if ( is_admin() ) {
   337 		if ( is_admin() ) {
   358 			return $terms;
   338 			return $terms;
   359 		}
   339 		}
   360 
   340 
   361 		// Make sure we are in the correct taxonomy.
   341 		// Make sure we are in the correct taxonomy.
   379 	}
   359 	}
   380 
   360 
   381 	/**
   361 	/**
   382 	 * Register custom setting on the Settings -> Reading screen.
   362 	 * Register custom setting on the Settings -> Reading screen.
   383 	 *
   363 	 *
   384 	 * @static
       
   385 	 * @access public
       
   386 	 * @since Twenty Fourteen 1.0
   364 	 * @since Twenty Fourteen 1.0
   387 	 */
   365 	 */
   388 	public static function register_setting() {
   366 	public static function register_setting() {
   389 		register_setting( 'featured-content', 'featured-content', array( __CLASS__, 'validate_settings' ) );
   367 		register_setting( 'featured-content', 'featured-content', array( __CLASS__, 'validate_settings' ) );
   390 	}
   368 	}
   391 
   369 
   392 	/**
   370 	/**
   393 	 * Add settings to the Customizer.
   371 	 * Add settings to the Customizer.
   394 	 *
   372 	 *
   395 	 * @static
       
   396 	 * @access public
       
   397 	 * @since Twenty Fourteen 1.0
   373 	 * @since Twenty Fourteen 1.0
   398 	 *
   374 	 *
   399 	 * @param WP_Customize_Manager $wp_customize Customizer object.
   375 	 * @param WP_Customize_Manager $wp_customize Customizer object.
   400 	 */
   376 	 */
   401 	public static function customize_register( $wp_customize ) {
   377 	public static function customize_register( $wp_customize ) {
   402 		$wp_customize->add_section( 'featured_content', array(
   378 		$wp_customize->add_section(
   403 			'title'          => __( 'Featured Content', 'twentyfourteen' ),
   379 			'featured_content', array(
   404 			'description'    => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
   380 				'title'          => __( 'Featured Content', 'twentyfourteen' ),
   405 				esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
   381 				'description'    => sprintf(
   406 				admin_url( 'edit.php?show_sticky=1' )
   382 					__( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
   407 			),
   383 					esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
   408 			'priority'       => 130,
   384 					admin_url( 'edit.php?show_sticky=1' )
   409 			'theme_supports' => 'featured-content',
   385 				),
   410 		) );
   386 				'priority'       => 130,
       
   387 				'theme_supports' => 'featured-content',
       
   388 			)
       
   389 		);
   411 
   390 
   412 		// Add Featured Content settings.
   391 		// Add Featured Content settings.
   413 		$wp_customize->add_setting( 'featured-content[tag-name]', array(
   392 		$wp_customize->add_setting(
   414 			'default'              => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ),
   393 			'featured-content[tag-name]', array(
   415 			'type'                 => 'option',
   394 				'default'              => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ),
   416 			'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
   395 				'type'                 => 'option',
   417 		) );
   396 				'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
   418 		$wp_customize->add_setting( 'featured-content[hide-tag]', array(
   397 			)
   419 			'default'              => true,
   398 		);
   420 			'type'                 => 'option',
   399 		$wp_customize->add_setting(
   421 			'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
   400 			'featured-content[hide-tag]', array(
   422 		) );
   401 				'default'              => true,
       
   402 				'type'                 => 'option',
       
   403 				'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
       
   404 			)
       
   405 		);
   423 
   406 
   424 		// Add Featured Content controls.
   407 		// Add Featured Content controls.
   425 		$wp_customize->add_control( 'featured-content[tag-name]', array(
   408 		$wp_customize->add_control(
   426 			'label'    => __( 'Tag Name', 'twentyfourteen' ),
   409 			'featured-content[tag-name]', array(
   427 			'section'  => 'featured_content',
   410 				'label'    => __( 'Tag Name', 'twentyfourteen' ),
   428 			'priority' => 20,
   411 				'section'  => 'featured_content',
   429 		) );
   412 				'priority' => 20,
   430 		$wp_customize->add_control( 'featured-content[hide-tag]', array(
   413 			)
   431 			'label'    => __( 'Don&rsquo;t display tag on front end.', 'twentyfourteen' ),
   414 		);
   432 			'section'  => 'featured_content',
   415 		$wp_customize->add_control(
   433 			'type'     => 'checkbox',
   416 			'featured-content[hide-tag]', array(
   434 			'priority' => 30,
   417 				'label'    => __( 'Don&rsquo;t display tag on front end.', 'twentyfourteen' ),
   435 		) );
   418 				'section'  => 'featured_content',
       
   419 				'type'     => 'checkbox',
       
   420 				'priority' => 30,
       
   421 			)
       
   422 		);
   436 	}
   423 	}
   437 
   424 
   438 	/**
   425 	/**
   439 	 * Enqueue the tag suggestion script.
   426 	 * Enqueue the tag suggestion script.
   440 	 *
   427 	 *
   441 	 * @static
       
   442 	 * @access public
       
   443 	 * @since Twenty Fourteen 1.0
   428 	 * @since Twenty Fourteen 1.0
   444 	 */
   429 	 */
   445 	public static function enqueue_scripts() {
   430 	public static function enqueue_scripts() {
   446 		wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20131022', true );
   431 		wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20131022', true );
   447 	}
   432 	}
   456 	 *
   441 	 *
   457 	 * In the event that you only require one setting, you may pass
   442 	 * In the event that you only require one setting, you may pass
   458 	 * its name as the first parameter to the function and only that
   443 	 * its name as the first parameter to the function and only that
   459 	 * value will be returned.
   444 	 * value will be returned.
   460 	 *
   445 	 *
   461 	 * @static
       
   462 	 * @access public
       
   463 	 * @since Twenty Fourteen 1.0
   446 	 * @since Twenty Fourteen 1.0
   464 	 *
   447 	 *
   465 	 * @param string $key The key of a recognized setting.
   448 	 * @param string $key The key of a recognized setting.
   466 	 * @return mixed Array of all settings by default. A single value if passed as first parameter.
   449 	 * @return mixed Array of all settings by default. A single value if passed as first parameter.
   467 	 */
   450 	 */
   489 	 *
   472 	 *
   490 	 * Make sure that all user supplied content is in an expected
   473 	 * Make sure that all user supplied content is in an expected
   491 	 * format before saving to the database. This function will also
   474 	 * format before saving to the database. This function will also
   492 	 * delete the transient set in Featured_Content::get_featured_content().
   475 	 * delete the transient set in Featured_Content::get_featured_content().
   493 	 *
   476 	 *
   494 	 * @static
       
   495 	 * @access public
       
   496 	 * @since Twenty Fourteen 1.0
   477 	 * @since Twenty Fourteen 1.0
   497 	 *
   478 	 *
   498 	 * @param array $input Array of settings input.
   479 	 * @param array $input Array of settings input.
   499 	 * @return array Validated settings output.
   480 	 * @return array Validated settings output.
   500 	 */
   481 	 */