Changeset 8118
- Timestamp:
- 01/21/2019 07:09:55 AM (6 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r7955 r8118 50 50 add_action( 'wp_head', array( Template::class, 'output_meta' ), 1 ); 51 51 add_action( 'wp_head', array( Template::class, 'hreflang_link_attributes' ), 2 ); 52 add_action( 'wp_head', array( Template::class, 'archive_link_rel_prev_next' ), 3 ); 52 53 53 54 // Cron tasks. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r8116 r8118 160 160 161 161 /** 162 * Prints <link rel="prev|next"> tags for archives. 163 * 164 * @static 165 */ 166 public static function archive_link_rel_prev_next() { 167 global $paged, $wp_query; 168 if ( ! is_archive() && ! is_search() ) { 169 return; 170 } 171 172 $max_page = $wp_query->max_num_pages; 173 if ( ! $paged ) { 174 $paged = 1; 175 } 176 177 $nextpage = intval( $paged ) + 1; 178 $prevpage = intval( $paged ) - 1; 179 180 if ( $prevpage >= 1 ) { 181 printf( 182 '<link rel="prev" href="%s">' . "\n", 183 esc_url( get_pagenum_link( $prevpage ) ) 184 ); 185 } 186 187 if ( $nextpage <= $max_page ) { 188 printf( 189 '<link rel="next" href="%s">' . "\n", 190 esc_url( get_pagenum_link( $nextpage ) ) 191 ); 192 } 193 } 194 195 /** 162 196 * Gets current major WP version to check against "Tested up to" value. 163 197 *
Note: See TracChangeset
for help on using the changeset viewer.