Changeset 45590 for trunk/src/wp-includes/general-template.php
- Timestamp:
- 07/02/2019 11:41:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r45580 r45590 1081 1081 1082 1082 // If on an author archive, use the author's display name. 1083 } elseif ( is_author() && $author = get_queried_object() ) { 1083 } elseif ( is_author() && get_queried_object() ) { 1084 $author = get_queried_object(); 1084 1085 $title['title'] = $author->display_name; 1085 1086 … … 1875 1876 1876 1877 if ( 'monthly' == $r['type'] ) { 1877 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; 1878 $key = md5( $query ); 1879 $key = "wp_get_archives:$key:$last_changed"; 1880 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1878 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; 1879 $key = md5( $query ); 1880 $key = "wp_get_archives:$key:$last_changed"; 1881 $results = wp_cache_get( $key, 'posts' ); 1882 if ( ! $results ) { 1881 1883 $results = $wpdb->get_results( $query ); 1882 1884 wp_cache_set( $key, $results, 'posts' ); … … 1899 1901 } 1900 1902 } elseif ( 'yearly' == $r['type'] ) { 1901 $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; 1902 $key = md5( $query ); 1903 $key = "wp_get_archives:$key:$last_changed"; 1904 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1903 $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; 1904 $key = md5( $query ); 1905 $key = "wp_get_archives:$key:$last_changed"; 1906 $results = wp_cache_get( $key, 'posts' ); 1907 if ( ! $results ) { 1905 1908 $results = $wpdb->get_results( $query ); 1906 1909 wp_cache_set( $key, $results, 'posts' ); … … 1922 1925 } 1923 1926 } elseif ( 'daily' == $r['type'] ) { 1924 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; 1925 $key = md5( $query ); 1926 $key = "wp_get_archives:$key:$last_changed"; 1927 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1927 $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; 1928 $key = md5( $query ); 1929 $key = "wp_get_archives:$key:$last_changed"; 1930 $results = wp_cache_get( $key, 'posts' ); 1931 if ( ! $results ) { 1928 1932 $results = $wpdb->get_results( $query ); 1929 1933 wp_cache_set( $key, $results, 'posts' ); … … 1946 1950 } 1947 1951 } elseif ( 'weekly' == $r['type'] ) { 1948 $week = _wp_mysql_week( '`post_date`' ); 1949 $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; 1950 $key = md5( $query ); 1951 $key = "wp_get_archives:$key:$last_changed"; 1952 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1952 $week = _wp_mysql_week( '`post_date`' ); 1953 $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; 1954 $key = md5( $query ); 1955 $key = "wp_get_archives:$key:$last_changed"; 1956 $results = wp_cache_get( $key, 'posts' ); 1957 if ( ! $results ) { 1953 1958 $results = $wpdb->get_results( $query ); 1954 1959 wp_cache_set( $key, $results, 'posts' ); … … 1988 1993 $key = md5( $query ); 1989 1994 $key = "wp_get_archives:$key:$last_changed"; 1990 if ( ! $results = wp_cache_get( $key, 'posts' ) ) { 1995 $results = wp_cache_get( $key, 'posts' ); 1996 if ( ! $results ) { 1991 1997 $results = $wpdb->get_results( $query ); 1992 1998 wp_cache_set( $key, $results, 'posts' ); … … 3831 3837 } 3832 3838 3833 if ( $lang = get_bloginfo( 'language' ) ) { 3839 $lang = get_bloginfo( 'language' ); 3840 if ( $lang ) { 3834 3841 if ( get_option( 'html_type' ) == 'text/html' || $doctype == 'html' ) { 3835 3842 $attributes[] = 'lang="' . esc_attr( $lang ) . '"';
Note: See TracChangeset
for help on using the changeset viewer.