IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 719 | 719 | * @return string Link. |
| 720 | 720 | */ |
| 721 | 721 | function _wp_link_page( $i ) { |
| 722 | | global $wp_rewrite; |
| 723 | | $post = get_post(); |
| 724 | | |
| 725 | | if ( 1 == $i ) { |
| 726 | | $url = get_permalink(); |
| 727 | | } else { |
| 728 | | if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) ) |
| 729 | | $url = add_query_arg( 'page', $i, get_permalink() ); |
| 730 | | elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID ) |
| 731 | | $url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged'); |
| 732 | | else |
| 733 | | $url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged'); |
| 734 | | } |
| 735 | | |
| | 722 | $url = get_paginated_post_url( get_the_ID(), $i ); |
| 736 | 723 | return '<a href="' . esc_url( $url ) . '">'; |
| 737 | 724 | } |
| 738 | 725 | |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 73 | 73 | * |
| 74 | 74 | * @since 1.0.0 |
| 75 | 75 | * |
| 76 | | * @param int $id Optional. Post ID. |
| | 76 | * @param int|object $id Optional. Post ID or post object. |
| 77 | 77 | * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name. |
| 78 | 78 | * @return string |
| 79 | 79 | */ |
| … |
… |
|
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | 1837 | /** |
| | 1838 | * Return URL for post at the required page |
| | 1839 | * |
| | 1840 | * @param int $post_id Post to create link for |
| | 1841 | * @param int $i Page number to create link for |
| | 1842 | * |
| | 1843 | * @return string |
| | 1844 | */ |
| | 1845 | function get_paginated_post_url( $post_id, $i ) { |
| | 1846 | global $wp_rewrite; |
| | 1847 | $post = get_post( $post_id ); |
| | 1848 | |
| | 1849 | if ( 1 == $i ) { |
| | 1850 | $url = get_permalink( $post ); |
| | 1851 | } else { |
| | 1852 | if ( '' == get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ) ) ) |
| | 1853 | $url = add_query_arg( 'page', $i, get_permalink( $post ) ); |
| | 1854 | elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) |
| | 1855 | $url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' ); |
| | 1856 | else |
| | 1857 | $url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( $i, 'single_paged' ); |
| | 1858 | } |
| | 1859 | return $url; |
| | 1860 | } |
| | 1861 | |
| | 1862 | /** |
| 1838 | 1863 | * Retrieve the Press This bookmarklet link. |
| 1839 | 1864 | * |
| 1840 | 1865 | * Use this in 'a' element 'href' attribute. |
| … |
… |
|
| 2320 | 2345 | |
| 2321 | 2346 | $link = get_permalink( $id ); |
| 2322 | 2347 | |
| 2323 | | if ( $page = get_query_var('cpage') ) |
| 2324 | | $link = get_comments_pagenum_link( $page ); |
| | 2348 | if ( $page = get_query_var( 'page' ) ) |
| | 2349 | $link = get_paginated_post_url( $id, $page ); |
| | 2350 | |
| | 2351 | if ( $cpage = get_query_var('cpage') ) |
| | 2352 | $link = get_comments_pagenum_link( $cpage ); |
| 2325 | 2353 | |
| 2326 | 2354 | echo "<link rel='canonical' href='$link' />\n"; |
| 2327 | 2355 | } |