catchresponsive_content_nav

Display navigation to next/previous pages when applicable.

Description

catchresponsive_content_nav( $nav_id ); 

Parameters (1)

0. $nav_id
The nav id.

Usage

  1. if ( !function_exists( 'catchresponsive_content_nav' ) ) { 
  2. require_once '/inc/catchresponsive-core.php'; 
  3.  
  4. // The nav id. 
  5. $nav_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = catchresponsive_content_nav($nav_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/catchresponsive-core.php  
  1. function catchresponsive_content_nav( $nav_id ) { 
  2. global $wp_query, $post; 
  3.  
  4. // Don't print empty markup on single pages if there's nowhere to navigate. 
  5. if ( is_single() ) { 
  6. $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); 
  7. $next = get_adjacent_post( false, '', false ); 
  8.  
  9. if ( ! $next && ! $previous ) 
  10. return; 
  11.  
  12. // Don't print empty markup in archives if there's only one page. 
  13. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) { 
  14. return; 
  15.  
  16.  
  17. $pagination_type = $options['pagination_type']; 
  18.  
  19. $nav_class = ( is_single() ) ? 'site-navigation post-navigation' : 'site-navigation paging-navigation'; 
  20.  
  21. /** 
  22. * Check if navigation type is Jetpack Infinite Scroll and if it is enabled, else goto default pagination 
  23. * if it's active then disable pagination 
  24. */ 
  25. if ( ( 'infinite-scroll-click' == $pagination_type || 'infinite-scroll-scroll' == $pagination_type ) && class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' ) ) { 
  26. return false; 
  27.  
  28. ?> 
  29. <nav role="navigation" id="<?php echo esc_attr( $nav_id ); ?>"> 
  30. <h3 class="screen-reader-text"><?php _e( 'Post navigation', 'catch-responsive' ); ?></h3> 
  31. <?php 
  32. /** 
  33. * Check if navigation type is numeric and if Wp-PageNavi Plugin is enabled 
  34. */ 
  35. if ( 'numeric' == $pagination_type && function_exists( 'wp_pagenavi' ) ) { 
  36. wp_pagenavi(); 
  37. else { ?> 
  38. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'catch-responsive' ) ); ?></div> 
  39. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'catch-responsive' ) ); ?></div> 
  40. <?php 
  41. } ?> 
  42. </nav><!-- #nav --> 
  43. <?php