From fea1e5b2cc72082ee4c534cb3fee285e15b23b88 Mon Sep 17 00:00:00 2001 From: Ren <18050944+renintw@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:11:57 +0800 Subject: [PATCH] Fix browser titles (#2672) --- .../themes/pub/wporg-learn-2024/functions.php | 1 + .../themes/pub/wporg-learn-2024/inc/head.php | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 wp-content/themes/pub/wporg-learn-2024/inc/head.php diff --git a/wp-content/themes/pub/wporg-learn-2024/functions.php b/wp-content/themes/pub/wporg-learn-2024/functions.php index c5795d86f..e0a7bdca0 100644 --- a/wp-content/themes/pub/wporg-learn-2024/functions.php +++ b/wp-content/themes/pub/wporg-learn-2024/functions.php @@ -17,6 +17,7 @@ require_once __DIR__ . '/inc/block-config.php'; require_once __DIR__ . '/inc/block-hooks.php'; require_once __DIR__ . '/inc/query.php'; +require_once __DIR__ . '/inc/head.php'; /** * Actions and filters. diff --git a/wp-content/themes/pub/wporg-learn-2024/inc/head.php b/wp-content/themes/pub/wporg-learn-2024/inc/head.php new file mode 100644 index 000000000..cafe77d7a --- /dev/null +++ b/wp-content/themes/pub/wporg-learn-2024/inc/head.php @@ -0,0 +1,59 @@ +labels->singular_name; + } + } + + // If results are paged and the max number of pages is known. + if ( is_paged() && $wp_query->max_num_pages ) { + $parts['page'] = sprintf( + // translators: 1: current page number, 2: total number of pages + __( 'Page %1$s of %2$s', 'wporg-learn' ), + get_query_var( 'paged' ), + $wp_query->max_num_pages + ); + } + + return $parts; +} + +/** + * Customizes the document title separator. + * + * @param string $separator Current document title separator. + * @return string + */ +function document_title_separator( $separator ) { + return '|'; +}