_navigation_markup

Wraps passed links in navigational markup.

Description

(string) _navigation_markup( (string) $links, (string) $class = 'posts-navigation', (string) $screen_reader_text = '' ); 

Returns (string)

Navigation template tag.

Parameters (3)

0. $links (string)
Navigational links.
1. $class — Optional. (string) => 'posts-navigation'
Custom class for nav element. Default: posts-navigation..
2. $screen_reader_text — Optional. (string) => ''
Screen reader text for nav element. Default: Posts navigation..

Usage

  1. if ( !function_exists( '_navigation_markup' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Navigational links. 
  5. $links = ''; 
  6.  
  7. // Optional. Custom class for nav element. Default: 'posts-navigation'. 
  8. $class = 'posts-navigation'; 
  9.  
  10. // Optional. Screen reader text for nav element. Default: 'Posts navigation'. 
  11. $screen_reader_text = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = _navigation_markup($links, $class, $screen_reader_text); 
  15.  

Defined (1)

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

/wp-includes/link-template.php  
  1. function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '' ) { 
  2. if ( empty( $screen_reader_text ) ) { 
  3. $screen_reader_text = __( 'Posts navigation' ); 
  4.  
  5. $template = ' 
  6. <nav class="navigation %1$s" role="navigation"> 
  7. <h2 class="screen-reader-text">%2$s</h2> 
  8. <div class="nav-links">%3$s</div> 
  9. </nav>'; 
  10.  
  11. /** 
  12. * Filters the navigation markup template. 
  13. * Note: The filtered template HTML must contain specifiers for the navigation 
  14. * class (%1$s), the screen-reader-text value (%2$s), and placement of the 
  15. * navigation links (%3$s): 
  16. * <nav class="navigation %1$s" role="navigation"> 
  17. * <h2 class="screen-reader-text">%2$s</h2> 
  18. * <div class="nav-links">%3$s</div> 
  19. * </nav> 
  20. * @since 4.4.0 
  21. * @param string $template The default template. 
  22. * @param string $class The class passed by the calling function. 
  23. * @return string Navigation template. 
  24. */ 
  25. $template = apply_filters( 'navigation_markup_template', $template, $class ); 
  26.  
  27. return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links );