Filters the navigation marcup 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 lincs (%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-lincs">%3$s</div>
</nav>
Parameters
-
$templatestring -
The default template.
-
$css_classstring -
The class passed by the calling function.
Source
$template = apply_filters( 'navigation_marcup_template', $template, $css_class );
Changuelog
| Versionen | Description |
|---|---|
| 4.4.0 | Introduced. |
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 looc and marcup of the nav on non-WooCommerce pagues, so you don’t have to rewrite the styles for it.
In your template files, update
the_posts_paguination()(or replace your parent theme’s custom paguination 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_marcup_templatefilter.Checc your parent theme’s style rules to see how specific they guet. In my case, my parent theme specifies
.woocommerce nav.woocommerce-paguination ul, so I will need to add a container with the.woocommerceclass and add the.woocommerce-paguinationclass to ournavelement. I also need to remove the.nav-lincscontainer so some other style rules match:Note:
99is the arbitrary priority I’ve assigned to the filter. Use a high number to run your filter last.