编辑:post-navigation-link.php
<?php /** * Server-side rendering of the `core/post-navigation-link` block. * * @package WordPress */ /** * Renders the `core/post-navigation-link` block on the server. * * @since 5.9.0 * * @param array $attributes Block attributes. * @param string $content Block default content. * * @return string Returns the next or previous post link that is adjacent to the current post. */ function render_block_core_post_navigation_link( $attributes, $content ) { if ( ! is_singular() ) { return ''; } // Get the navigation type to show the proper link. Available options are `next|previous`. $navigation_type = isset( $attributes['type'] ) ? $attributes['type'] : 'next'; // Allow only `next` and `previous` in `$navigation_type`. if ( ! in_array( $navigation_type, array( 'next', 'previous' ), true ) ) { return ''; } $classes = "post-navigation-link-$navigation_type"; if ( isset( $attributes['textAlign'] ) ) { $classes .= " has-text-align-{$attributes['textAlign']}"; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes, ) ); // Set default values. $format = '%link'; $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link' ) : _x( 'Previous', 'label for previous post link' ); $label = ''; // Only use hardcoded values here, otherwise we need to add escaping where these values are used. $arrow_map = array( 'none' => '', 'arrow' => array( 'next' => '→', 'previous' => '←', ), 'chevron' => array( 'next' => '»', 'previous' => '«', ), ); // If a custom label is provided, make this a link. // `$label` is used to prepend the provided label, if we want to show the page title as well. if ( isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ) { $label = "{$attributes['label']}"; $link = $label; } // If we want to also show the page title, make the page title a link and prepend the label. if ( isset( $attributes['showTitle'] ) && $attributes['showTitle'] ) { /* * If the label link option is not enabled but there is a custom label, * display the custom label as text before the linked title. */ if ( ! $attributes['linkLabel'] ) { if ( $label ) { $format = '<span class="post-navigation-link__label">' . wp_kses_post( $label ) . '</span> %link'; } $link = '%title'; } elseif ( isset( $attributes['linkLabel'] ) && $attributes['linkLabel'] ) { // If the label link option is enabled and there is a custom label, display it before the title. if ( $label ) { $link = '<span class="post-navigation-link__label">' . wp_kses_post( $label ) . '</span> <span class="post-navigation-link__title">%title</span>'; } else { /* * If the label link option is enabled and there is no custom label, * add a colon between the label and the post title. */ $label = 'next' === $navigation_type ? _x( 'Next:', 'label before the title of the next post' ) : _x( 'Previous:', 'label before the title of the previous post' ); $link = sprintf( '<span class="post-navigation-link__label">%1$s</span> <span class="post-navigation-link__title">%2$s</span>', wp_kses_post( $label ), '%title' ); } } } // Display arrows. if ( isset( $attributes['arrow'] ) && 'none' !== $attributes['arrow'] && isset( $arrow_map[ $attributes['arrow'] ] ) ) { $arrow = $arrow_map[ $attributes['arrow'] ][ $navigation_type ]; if ( 'next' === $navigation_type ) { $format = '%link<span class="wp-block-post-navigation-link__arrow-next is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span>'; } else { $format = '<span class="wp-block-post-navigation-link__arrow-previous is-arrow-' . $attributes['arrow'] . '" aria-hidden="true">' . $arrow . '</span>%link'; } } /* * The dynamic portion of the function name, `$navigation_type`, * Refers to the type of adjacency, 'next' or 'previous'. * * @see https://developer.wordpress.org/reference/functions/get_previous_post_link/ * @see https://developer.wordpress.org/reference/functions/get_next_post_link/ */ $get_link_function = "get_{$navigation_type}_post_link"; if ( ! empty( $attributes['taxonomy'] ) ) { $content = $get_link_function( $format, $link, true, '', $attributes['taxonomy'] ); } else { $content = $get_link_function( $format, $link ); } return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $content ); } /** * Registers the `core/post-navigation-link` block on the server. * * @since 5.9.0 */ function register_block_core_post_navigation_link() { register_block_type_from_metadata( __DIR__ . '/post-navigation-link', array( 'render_callback' => 'render_block_core_post_navigation_link', ) ); } add_action( 'init', 'register_block_core_post_navigation_link' );
保存文件
位置:
home
/
robertofarias
/
public_html
/
wp-includes
/
blocks
批量上传
创建
创建
批量权限
批量删除
名称
权限
大小
修改时间
操作
↑ 返回上级
-
-
-
-
accordion
drwxr-xr-x
-
2026-05-01 02:14
权限
删除
重命名
accordion-heading
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
accordion-item
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
accordion-panel
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
archives
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
audio
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
avatar
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
block
drwxr-xr-x
-
2024-07-17 11:52
权限
删除
重命名
button
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
buttons
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
calendar
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
categories
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
code
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
column
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
columns
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comment-author-name
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-content
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comment-date
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-edit-link
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-reply-link
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-template
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination-next
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination-numbers
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination-previous
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-title
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
cover
drwxr-xr-x
-
2026-05-01 02:14
权限
删除
重命名
details
drwxr-xr-x
-
2026-05-01 03:37
权限
删除
重命名
embed
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
file
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
footnotes
drwxr-xr-x
-
2023-08-09 11:43
权限
删除
重命名
freeform
drwxr-xr-x
-
2026-05-01 03:14
权限
删除
重命名
gallery
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
group
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
heading
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
home-link
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
html
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
image
drwxr-xr-x
-
2023-11-08 10:55
权限
删除
重命名
latest-comments
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
latest-posts
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
legacy-widget
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
list
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
list-item
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
loginout
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
math
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
media-text
drwxr-xr-x
-
2026-05-01 01:56
权限
删除
重命名
missing
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
more
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
navigation
drwxr-xr-x
-
2023-11-08 10:55
权限
删除
重命名
navigation-link
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
navigation-submenu
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
nextpage
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
page-list
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
page-list-item
drwxr-xr-x
-
2023-03-30 09:26
权限
删除
重命名
paragraph
drwxr-xr-x
-
2026-05-01 03:14
权限
删除
重命名
pattern
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-author
drwxr-xr-x
-
2025-12-04 05:42
权限
删除
重命名
post-author-biography
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
post-author-name
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
post-comments-count
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
post-comments-form
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-comments-link
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
post-content
drwxr-xr-x
-
2025-04-16 11:06
权限
删除
重命名
post-date
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-excerpt
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-featured-image
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-navigation-link
drwxr-xr-x
-
2023-03-30 09:26
权限
删除
重命名
post-template
drwxr-xr-x
-
2025-04-16 11:06
权限
删除
重命名
post-terms
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-time-to-read
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
post-title
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
preformatted
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
pullquote
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query
drwxr-xr-x
-
2024-04-03 10:16
权限
删除
重命名
query-no-results
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination-next
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination-numbers
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination-previous
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-title
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-total
drwxr-xr-x
-
2025-04-16 11:06
权限
删除
重命名
quote
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
read-more
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
rss
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
search
drwxr-xr-x
-
2026-05-01 03:14
权限
删除
重命名
separator
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
shortcode
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
site-logo
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
site-tagline
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
site-title
drwxr-xr-x
-
2023-03-30 09:26
权限
删除
重命名
social-link
drwxr-xr-x
-
2026-05-01 02:12
权限
删除
重命名
social-links
drwxr-xr-x
-
2026-05-01 02:25
权限
删除
重命名
spacer
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
table
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
tag-cloud
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
template-part
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
term-count
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
term-description
drwxr-xr-x
-
2023-08-09 11:43
权限
删除
重命名
term-name
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
term-template
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
terms-query
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
text-columns
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
verse
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
video
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
widget-group
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
accordion-item.php
-rw-r--r--
2.35 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
accordion.php
-rw-r--r--
1.12 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
archives.php
-rw-r--r--
4.31 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
blocks-json.php
-rw-r--r--
213.43 KB
2026-02-27 10:54
编辑
下载
权限
删除
重命名
calendar.php
-rw-r--r--
5.93 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
categories.php
-rw-r--r--
4.54 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
comments-pagination-next.php
-rw-r--r--
1.88 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
comments-pagination-numbers.php
-rw-r--r--
1.59 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
comments-pagination.php
-rw-r--r--
1.23 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
comments-title.php
-rw-r--r--
2.71 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
cover.php
-rw-r--r--
3.1 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
error_log
-rw-r--r--
39.29 KB
2026-05-01 18:01
编辑
下载
权限
删除
重命名
footnotes.php
-rw-r--r--
3.68 KB
2024-04-03 10:16
编辑
下载
权限
删除
重命名
gallery.php
-rw-r--r--
6.29 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
heading.php
-rw-r--r--
1.27 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
latest-comments.php
-rw-r--r--
4.91 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
legacy-widget.php
-rw-r--r--
3.92 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
list.php
-rw-r--r--
1.24 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
loginout.php
-rw-r--r--
1.63 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
media-text.php
-rw-r--r--
4.28 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
page-list-item.php
-rw-r--r--
361 B
2024-07-17 11:51
编辑
下载
权限
删除
重命名
page-list.php
-rw-r--r--
13.29 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
post-author-biography.php
-rw-r--r--
1.49 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-author-name.php
-rw-r--r--
1.91 KB
2025-05-01 11:02
编辑
下载
权限
删除
重命名
post-author.php
-rw-r--r--
2.67 KB
2025-05-01 11:02
编辑
下载
权限
删除
重命名
post-comments-form.php
-rw-r--r--
2.74 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-comments-link.php
-rw-r--r--
2.18 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-content.php
-rw-r--r--
2.29 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-excerpt.php
-rw-r--r--
3.53 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-featured-image.php
-rw-r--r--
9.14 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-navigation-link.php
-rw-r--r--
4.72 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-template.php
-rw-r--r--
5.61 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-terms.php
-rw-r--r--
3.55 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
post-time-to-read.php
-rw-r--r--
6.34 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-no-results.php
-rw-r--r--
1.8 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
query-pagination-next.php
-rw-r--r--
3.69 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-pagination-numbers.php
-rw-r--r--
4.66 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
query-pagination.php
-rw-r--r--
1.15 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
query-title.php
-rw-r--r--
2.87 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-total.php
-rw-r--r--
2.48 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
rss.php
-rw-r--r--
4.5 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
search.php
-rw-r--r--
23.26 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
site-tagline.php
-rw-r--r--
1.17 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
site-title.php
-rw-r--r--
1.82 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
social-link.php
-rw-r--r--
66.15 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
tag-cloud.php
-rw-r--r--
1.55 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
term-count.php
-rw-r--r--
1.8 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
term-description.php
-rw-r--r--
1.73 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
term-name.php
-rw-r--r--
2.02 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
term-template.php
-rw-r--r--
4.41 KB
2026-02-27 10:54
编辑
下载
权限
删除
重命名
widget-group.php
-rw-r--r--
2.38 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名