Skip to content

Commit

Permalink
Update site title.
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne committed Jan 23, 2024
1 parent 064d05e commit 54bdf05
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions source/wp-content/themes/wporg-main-2022/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* Actions and filters.
*/
add_filter( 'document_title_parts', __NAMESPACE__ . '\document_title' );
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets' );
add_action( 'init', __NAMESPACE__ . '\register_shortcodes' );
add_filter( 'wp_img_tag_add_loading_attr', __NAMESPACE__ . '\override_lazy_loading', 10, 2 );
Expand Down Expand Up @@ -358,3 +359,26 @@ function update_header_template_part_class( $block ) {
}
return $block;
}

/**
* Append an optimized site name.
*
* @param array $parts {
* The document title parts.
*
* @type string $title Title of the viewed page.
* @type string $page Optional. Page number if paginated.
* @type string $tagline Optional. Site description when on home page.
* @type string $site Optional. Site title when not on home page.
* }
* @return array Filtered title parts.
*/
function document_title( $parts ) {

if ( is_singular( 'and-handbook' ) ) {
// translators: %s: Name of the guide.
$parts['title'] = sprintf( __( '%s - Data Liberation', 'wporg' ), $parts['title'] );
}

return $parts;
}

0 comments on commit 54bdf05

Please sign in to comment.