apply_filters( 'navigation_markup_template', string $template , string $css_class )
Filters the navigation markup template.
Description
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>
Parameters
-
$template
string -
The default template.
-
$css_class
string -
The class passed by the calling function.
Return
string Navigation template.
Source
File: wp-includes/link-template.php
.
View all references
$template = apply_filters( 'navigation_markup_template', $template, $css_class );
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
When creating a child theme, if your parent theme includes styles for WooCommerce navigation which you prefer, here’s a simple way to match the look and markup of the nav on non-WooCommerce pages, so you don’t have to rewrite the styles for it.
In your template files, update
the_posts_pagination()
(or replace your parent theme’s custom pagination function) to match the default settings found inside WooCommerce. For example, inside search.php:In your functions.php file, update the HTML output of the navigation using the
navigation_markup_template
filter.Check your parent theme’s style rules to see how specific they get. In my case, my parent theme specifies
.woocommerce nav.woocommerce-pagination ul
, so I will need to add a container with the.woocommerce
class and add the.woocommerce-pagination
class to ournav
element. I also need to remove the.nav-links
container so some other style rules match:Note:
99
is the arbitrary priority I’ve assigned to the filter. Use a high number to run your filter last.