X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..febc815b2c9d85be5717da9e8d164bd2daa97e31:/wp-content/themes/twentyfourteen/inc/template-tags.php diff --git a/wp-content/themes/twentyfourteen/inc/template-tags.php b/wp-content/themes/twentyfourteen/inc/template-tags.php index d1f9bcfc..f63ee828 100644 --- a/wp-content/themes/twentyfourteen/inc/template-tags.php +++ b/wp-content/themes/twentyfourteen/inc/template-tags.php @@ -12,10 +12,15 @@ if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) : * Display navigation to next/previous set of posts when applicable. * * @since Twenty Fourteen 1.0 + * + * @global WP_Query $wp_query WordPress Query object. + * @global WP_Rewrite $wp_rewrite WordPress Rewrite object. */ function twentyfourteen_paging_nav() { + global $wp_query, $wp_rewrite; + // Don't print empty markup if there's only one page. - if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { + if ( $wp_query->max_num_pages < 2 ) { return; } @@ -31,14 +36,14 @@ function twentyfourteen_paging_nav() { $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; - $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; - $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%'; + $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; + $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%'; // Set up paginated links. $links = paginate_links( array( 'base' => $pagenum_link, 'format' => $format, - 'total' => $GLOBALS['wp_query']->max_num_pages, + 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map( 'urlencode', $query_args ), @@ -156,6 +161,7 @@ function twentyfourteen_category_transient_flusher() { add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' ); add_action( 'save_post', 'twentyfourteen_category_transient_flusher' ); +if ( ! function_exists( 'twentyfourteen_post_thumbnail' ) ) : /** * Display an optional post thumbnail. * @@ -163,6 +169,7 @@ add_action( 'save_post', 'twentyfourteen_category_transient_flusher' ); * views, or a div element when on single views. * * @since Twenty Fourteen 1.0 + * @since Twenty Fourteen 1.4 Was made 'pluggable', or overridable. */ function twentyfourteen_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { @@ -184,15 +191,37 @@ function twentyfourteen_post_thumbnail() { - + %2$s', + esc_url( get_permalink( get_the_ID() ) ), + /* translators: %s: Name of current post */ + sprintf( __( 'Continue reading %s ', 'twentyfourteen' ), '' . get_the_title( get_the_ID() ) . '' ) + ); + return ' … ' . $link; +} +add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' ); +endif;