diff options
author | Yury German <blueknight@gentoo.org> | 2019-04-28 18:30:29 -0400 |
---|---|---|
committer | Yury German <blueknight@gentoo.org> | 2019-04-28 18:30:29 -0400 |
commit | 4ef1e1c47c509ea8ca1f194fcfb9ce816c01f29e (patch) | |
tree | 171fddc56d74d8492ffb703f04543896b6344243 /themes/twentyfourteen/inc/featured-content.php | |
parent | Updating packages for 5.1.1 (diff) | |
download | blogs-gentoo-4ef1e1c47c509ea8ca1f194fcfb9ce816c01f29e.tar.gz blogs-gentoo-4ef1e1c47c509ea8ca1f194fcfb9ce816c01f29e.tar.bz2 blogs-gentoo-4ef1e1c47c509ea8ca1f194fcfb9ce816c01f29e.zip |
Updating the themes
Updated themes. The followng themes updated:
Mantra - 3.0.5 => 3.1.0, Twenty Fifteen 2.2 => 2.4
Twenty Fourteen 2.4 => 2.6, Twenty Sixteen 1.7 => 1.9
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'themes/twentyfourteen/inc/featured-content.php')
-rw-r--r-- | themes/twentyfourteen/inc/featured-content.php | 166 |
1 files changed, 76 insertions, 90 deletions
diff --git a/themes/twentyfourteen/inc/featured-content.php b/themes/twentyfourteen/inc/featured-content.php index ffeb993d..23fb38d7 100644 --- a/themes/twentyfourteen/inc/featured-content.php +++ b/themes/twentyfourteen/inc/featured-content.php @@ -23,8 +23,6 @@ class Featured_Content { * * @since Twenty Fourteen 1.0 * - * @static - * @access public * @var int */ public static $max_posts = 15; @@ -34,8 +32,6 @@ class Featured_Content { * * All custom functionality will be hooked into the "init" action. * - * @static - * @access public * @since Twenty Fourteen 1.0 */ public static function setup() { @@ -51,8 +47,6 @@ class Featured_Content { * If no theme support is found there is no need to hook into WordPress. * We'll just return early instead. * - * @static - * @access public * @since Twenty Fourteen 1.0 */ public static function init() { @@ -83,15 +77,15 @@ class Featured_Content { self::$max_posts = absint( $theme_support[0]['max_posts'] ); } - add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) ); - add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 ); - add_action( 'admin_init', array( __CLASS__, 'register_setting' ) ); - add_action( 'switch_theme', array( __CLASS__, 'delete_transient' ) ); - add_action( 'save_post', array( __CLASS__, 'delete_transient' ) ); - add_action( 'delete_post_tag', array( __CLASS__, 'delete_post_tag' ) ); - add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) ); - add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) ); - add_action( 'wp_loaded', array( __CLASS__, 'wp_loaded' ) ); + add_filter( $filter, array( __CLASS__, 'get_featured_posts' ) ); + add_action( 'customize_register', array( __CLASS__, 'customize_register' ), 9 ); + add_action( 'admin_init', array( __CLASS__, 'register_setting' ) ); + add_action( 'switch_theme', array( __CLASS__, 'delete_transient' ) ); + add_action( 'save_post', array( __CLASS__, 'delete_transient' ) ); + add_action( 'delete_post_tag', array( __CLASS__, 'delete_post_tag' ) ); + add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) ); + add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ) ); + add_action( 'wp_loaded', array( __CLASS__, 'wp_loaded' ) ); } /** @@ -100,13 +94,11 @@ class Featured_Content { * Has to run on wp_loaded so that the preview filters of the Customizer * have a chance to alter the value. * - * @static - * @access public * @since Twenty Fourteen 1.0 */ public static function wp_loaded() { if ( self::get_setting( 'hide-tag' ) ) { - add_filter( 'get_terms', array( __CLASS__, 'hide_featured_term' ), 10, 3 ); + add_filter( 'get_terms', array( __CLASS__, 'hide_featured_term' ), 10, 3 ); add_filter( 'get_the_terms', array( __CLASS__, 'hide_the_featured_term' ), 10, 3 ); } } @@ -114,8 +106,6 @@ class Featured_Content { /** * Get featured posts. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @return array Array of featured posts. @@ -128,10 +118,12 @@ class Featured_Content { return array(); } - $featured_posts = get_posts( array( - 'include' => $post_ids, - 'posts_per_page' => count( $post_ids ), - ) ); + $featured_posts = get_posts( + array( + 'include' => $post_ids, + 'posts_per_page' => count( $post_ids ), + ) + ); return $featured_posts; } @@ -144,8 +136,6 @@ class Featured_Content { * * Sets the "featured_content_ids" transient. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @return array Array of post IDs. @@ -160,18 +150,20 @@ class Featured_Content { if ( $term ) { // Query for featured posts. - $featured_ids = get_posts( array( - 'fields' => 'ids', - 'numberposts' => self::$max_posts, - 'suppress_filters' => false, - 'tax_query' => array( - array( - 'field' => 'term_id', - 'taxonomy' => 'post_tag', - 'terms' => $term->term_id, + $featured_ids = get_posts( + array( + 'fields' => 'ids', + 'numberposts' => self::$max_posts, + 'suppress_filters' => false, + 'tax_query' => array( + array( + 'field' => 'term_id', + 'taxonomy' => 'post_tag', + 'terms' => $term->term_id, + ), ), - ), - ) ); + ) + ); } // Get sticky posts if no Featured Content exists. @@ -189,8 +181,6 @@ class Featured_Content { /** * Return an array with IDs of posts maked as sticky. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @return array Array of sticky posts. @@ -206,8 +196,6 @@ class Featured_Content { * * @see Featured_Content::validate_settings(). * - * @static - * @access public * @since Twenty Fourteen 1.0 */ public static function delete_transient() { @@ -221,8 +209,6 @@ class Featured_Content { * Hooked onto the 'pre_get_posts' action, this changes the parameters of * the query before it gets any posts. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param WP_Query $query WP_Query object. @@ -269,8 +255,6 @@ class Featured_Content { * * @see Featured_Content::validate_settings(). * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param int $tag_id The term_id of the tag that has been deleted. @@ -283,7 +267,7 @@ class Featured_Content { } $settings['tag-id'] = 0; - $settings = self::validate_settings( $settings ); + $settings = self::validate_settings( $settings ); update_option( 'featured-content', $settings ); } @@ -292,8 +276,6 @@ class Featured_Content { * * Hooks into the "get_terms" filter. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param array $terms List of term objects. This is the return value of get_terms(). @@ -340,8 +322,6 @@ class Featured_Content { * * Hooks into the "get_the_terms" filter. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param array $terms A list of term objects. This is the return value of get_the_terms(). @@ -381,8 +361,6 @@ class Featured_Content { /** * Register custom setting on the Settings -> Reading screen. * - * @static - * @access public * @since Twenty Fourteen 1.0 */ public static function register_setting() { @@ -392,54 +370,66 @@ class Featured_Content { /** * Add settings to the Customizer. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param WP_Customize_Manager $wp_customize Customizer object. */ public static function customize_register( $wp_customize ) { - $wp_customize->add_section( 'featured_content', array( - 'title' => __( 'Featured Content', 'twentyfourteen' ), - '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' ), - esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), - admin_url( 'edit.php?show_sticky=1' ) - ), - 'priority' => 130, - 'theme_supports' => 'featured-content', - ) ); + $wp_customize->add_section( + 'featured_content', + array( + 'title' => __( 'Featured Content', 'twentyfourteen' ), + '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' ), + esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), + admin_url( 'edit.php?show_sticky=1' ) + ), + 'priority' => 130, + 'theme_supports' => 'featured-content', + ) + ); // Add Featured Content settings. - $wp_customize->add_setting( 'featured-content[tag-name]', array( - 'default' => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), - 'type' => 'option', - 'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ), - ) ); - $wp_customize->add_setting( 'featured-content[hide-tag]', array( - 'default' => true, - 'type' => 'option', - 'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ), - ) ); + $wp_customize->add_setting( + 'featured-content[tag-name]', + array( + 'default' => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), + 'type' => 'option', + 'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ), + ) + ); + $wp_customize->add_setting( + 'featured-content[hide-tag]', + array( + 'default' => true, + 'type' => 'option', + 'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ), + ) + ); // Add Featured Content controls. - $wp_customize->add_control( 'featured-content[tag-name]', array( - 'label' => __( 'Tag Name', 'twentyfourteen' ), - 'section' => 'featured_content', - 'priority' => 20, - ) ); - $wp_customize->add_control( 'featured-content[hide-tag]', array( - 'label' => __( 'Don’t display tag on front end.', 'twentyfourteen' ), - 'section' => 'featured_content', - 'type' => 'checkbox', - 'priority' => 30, - ) ); + $wp_customize->add_control( + 'featured-content[tag-name]', + array( + 'label' => __( 'Tag Name', 'twentyfourteen' ), + 'section' => 'featured_content', + 'priority' => 20, + ) + ); + $wp_customize->add_control( + 'featured-content[hide-tag]', + array( + 'label' => __( 'Don’t display tag on front end.', 'twentyfourteen' ), + 'section' => 'featured_content', + 'type' => 'checkbox', + 'priority' => 30, + ) + ); } /** * Enqueue the tag suggestion script. * - * @static - * @access public * @since Twenty Fourteen 1.0 */ public static function enqueue_scripts() { @@ -458,8 +448,6 @@ class Featured_Content { * its name as the first parameter to the function and only that * value will be returned. * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param string $key The key of a recognized setting. @@ -491,8 +479,6 @@ class Featured_Content { * format before saving to the database. This function will also * delete the transient set in Featured_Content::get_featured_content(). * - * @static - * @access public * @since Twenty Fourteen 1.0 * * @param array $input Array of settings input. |