Filter hook 'navigation_markup_template'

in WP Core File wp-includes/link-template.php at line 3055

View Source

navigation_markup_template

Filter Hook
Description
Filters the navigation markup template. Note: The filtered template HTML must contain specifiers for the navigation class (%1$s), the screen-reader-text value (%2$s), placement of the navigation links (%3$s), and ARIA label text if screen-reader-text does not fit that (%4$s):

Hook Information

File Location wp-includes/link-template.php View on GitHub
Hook Type Filter
Line Number 3055

Hook Parameters

Type Name Description
string $template The default template.
string $css_class The class passed by the calling function.

Usage Examples

Basic Usage
<?php
// Hook into navigation_markup_template
add_filter('navigation_markup_template', 'my_custom_filter', 10, 2);

function my_custom_filter($template, $css_class) {
    // Your custom filtering logic here
    return $template;
}

Source Code Context

wp-includes/link-template.php:3055 - How this hook is used in WordPress core
<?php
3050  	 * @since 4.4.0
3051  	 *
3052  	 * @param string $template  The default template.
3053  	 * @param string $css_class The class passed by the calling function.
3054  	 */
3055  	$template = apply_filters( 'navigation_markup_template', $template, $css_class );
3056  
3057  	return sprintf( $template, sanitize_html_class( $css_class ), esc_html( $screen_reader_text ), $links, esc_attr( $aria_label ) );
3058  }
3059  
3060  /**

PHP Documentation

<?php
/**
	 * Filters the navigation markup template.
	 *
	 * Note: The filtered template HTML must contain specifiers for the navigation
	 * class (%1$s), the screen-reader-text value (%2$s), placement of the navigation
	 * links (%3$s), and ARIA label text if screen-reader-text does not fit that (%4$s):
	 *
	 *     <nav class="navigation %1$s" aria-label="%4$s">
	 *         <h2 class="screen-reader-text">%2$s</h2>
	 *         <div class="nav-links">%3$s</div>
	 *     </nav>
	 *
	 * @since 4.4.0
	 *
	 * @param string $template  The default template.
	 * @param string $css_class The class passed by the calling function.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.