返回介绍

_navigation_markup()

发布于 2017-09-11 13:27:56 字数 3440 浏览 1055 评论 0 收藏 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

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

Wraps passed links in navigational markup.


description


参数

$links

(string) (Required) Navigational links.

$class

(string) (Optional) Custom class for nav element. Default: 'posts-navigation'.

Default value: 'posts-navigation'

$screen_reader_text

(string) (Optional) Screen reader text for nav element. Default: 'Posts navigation'.

Default value: ''


返回值

(string) Navigation template tag.


源代码

File: wp-includes/link-template.php

function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '' ) {
	if ( empty( $screen_reader_text ) ) {
		$screen_reader_text = __( 'Posts navigation' );
	}

	$template = '
	<nav class="navigation %1$s" role="navigation">
		<h2 class="screen-reader-text">%2$s</h2>
		<div class="nav-links">%3$s</div>
	</nav>';

	/**
	 * 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), and placement of the
	 * navigation links (%3$s):
	 *
	 *     <nav class="navigation %1$s" role="navigation">
	 *         <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 $class    The class passed by the calling function.
	 * @return string Navigation template.
	 */
	$template = apply_filters( 'navigation_markup_template', $template, $class );

	return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links );
}

更新日志

Versiondescription
4.1.0Introduced.

相关函数

Uses

  • wp-includes/link-template.php: navigation_markup_template
  • wp-includes/l10n.php: __()
  • wp-includes/formatting.php: esc_html()
  • wp-includes/formatting.php: sanitize_html_class()
  • wp-includes/plugin.php: apply_filters()

Used By

  • wp-includes/link-template.php: get_the_comments_navigation()
  • wp-includes/link-template.php: get_the_comments_pagination()
  • wp-includes/link-template.php: get_the_post_navigation()
  • wp-includes/link-template.php: get_the_posts_navigation()
  • wp-includes/link-template.php: get_the_posts_pagination()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文