Changeset 8372
- Timestamp:
- 02/28/2019 07:16:13 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php
r8371 r8372 53 53 add_theme_support( 'title-tag' ); 54 54 55 // Add any actions/filters that should run for WordPress.TV & Blog.WordPress.TV here.56 55 add_action( 'wp_head', array( $this, 'rel_canonical' ) ); 56 add_action( 'wp_head', array( $this, 'archive_link_rel_prev_next' ) ); 57 57 } 58 58 … … 105 105 106 106 return $title; 107 } 108 109 /** 110 * Outputs <link rel="prev|next"> tags for archives. 111 */ 112 function archive_link_rel_prev_next() { 113 global $paged, $wp_query; 114 if ( ! is_archive() && ! is_search() ) { 115 return; 116 } 117 118 $max_page = $wp_query->max_num_pages; 119 if ( ! $paged ) { 120 $paged = 1; 121 } 122 123 $nextpage = intval( $paged ) + 1; 124 $prevpage = intval( $paged ) - 1; 125 126 if ( $prevpage >= 1 ) { 127 printf( 128 '<link rel="prev" href="%s">' . "\n", 129 esc_url( get_pagenum_link( $prevpage ) ) 130 ); 131 } 132 133 if ( $nextpage <= $max_page ) { 134 printf( 135 '<link rel="next" href="%s">' . "\n", 136 esc_url( get_pagenum_link( $nextpage ) ) 137 ); 138 } 107 139 } 108 140
Note: See TracChangeset
for help on using the changeset viewer.