@@ 2474-2500 (lines=27) @@ | ||
2471 | * } |
|
2472 | * @return string Markup for posts links. |
|
2473 | */ |
|
2474 | function get_the_posts_navigation( $args = array() ) { |
|
2475 | $navigation = ''; |
|
2476 | ||
2477 | // Don't print empty markup if there's only one page. |
|
2478 | if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { |
|
2479 | $args = wp_parse_args( $args, array( |
|
2480 | 'prev_text' => __( 'Older posts' ), |
|
2481 | 'next_text' => __( 'Newer posts' ), |
|
2482 | 'screen_reader_text' => __( 'Posts navigation' ), |
|
2483 | ) ); |
|
2484 | ||
2485 | $next_link = get_previous_posts_link( $args['next_text'] ); |
|
2486 | $prev_link = get_next_posts_link( $args['prev_text'] ); |
|
2487 | ||
2488 | if ( $prev_link ) { |
|
2489 | $navigation .= '<div class="nav-previous">' . $prev_link . '</div>'; |
|
2490 | } |
|
2491 | ||
2492 | if ( $next_link ) { |
|
2493 | $navigation .= '<div class="nav-next">' . $next_link . '</div>'; |
|
2494 | } |
|
2495 | ||
2496 | $navigation = _navigation_markup( $navigation, 'posts-navigation', $args['screen_reader_text'] ); |
|
2497 | } |
|
2498 | ||
2499 | return $navigation; |
|
2500 | } |
|
2501 | ||
2502 | /** |
|
2503 | * Displays the navigation to next/previous set of posts, when applicable. |
|
@@ 2815-2841 (lines=27) @@ | ||
2812 | * } |
|
2813 | * @return string Markup for comments links. |
|
2814 | */ |
|
2815 | function get_the_comments_navigation( $args = array() ) { |
|
2816 | $navigation = ''; |
|
2817 | ||
2818 | // Are there comments to navigate through? |
|
2819 | if ( get_comment_pages_count() > 1 ) { |
|
2820 | $args = wp_parse_args( $args, array( |
|
2821 | 'prev_text' => __( 'Older comments' ), |
|
2822 | 'next_text' => __( 'Newer comments' ), |
|
2823 | 'screen_reader_text' => __( 'Comments navigation' ), |
|
2824 | ) ); |
|
2825 | ||
2826 | $prev_link = get_previous_comments_link( $args['prev_text'] ); |
|
2827 | $next_link = get_next_comments_link( $args['next_text'] ); |
|
2828 | ||
2829 | if ( $prev_link ) { |
|
2830 | $navigation .= '<div class="nav-previous">' . $prev_link . '</div>'; |
|
2831 | } |
|
2832 | ||
2833 | if ( $next_link ) { |
|
2834 | $navigation .= '<div class="nav-next">' . $next_link . '</div>'; |
|
2835 | } |
|
2836 | ||
2837 | $navigation = _navigation_markup( $navigation, 'comment-navigation', $args['screen_reader_text'] ); |
|
2838 | } |
|
2839 | ||
2840 | return $navigation; |
|
2841 | } |
|
2842 | ||
2843 | /** |
|
2844 | * Displays navigation to next/previous set of comments, when applicable. |