style: integrate CHRNX navigation and footer

This commit is contained in:
chrnx committed 2026-08-12 15:08:07 -05:00
1 parent 5a49cc5137
commit c7de54995f
8 files changed
+437 -26

No files matched your search

+33
View File
@@ -17,6 +17,39 @@ function chrnx_get_heading_level( $value, $fallback_level = 2 ) {
return in_array( $level, array( 2, 3, 4, 5, 6 ), true ) ? $level : $fallback_level;
}
/**
* Return the canonical primary-navigation URL for the current main query.
*
* @return string Current navigation destination URL, or an empty string.
*/
function chrnx_get_current_navigation_destination() {
$journal_url = home_url( '/journal/' );
if ( is_404() ) {
return '';
}
if ( is_home() || is_search() || is_singular( 'post' ) || is_tax( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) ) ) {
return $journal_url;
}
if ( is_front_page() || ! is_page() ) {
return '';
}
$page = get_queried_object();
if ( ! $page instanceof WP_Post || 'page' !== $page->post_type ) {
return '';
}
$page_uri = get_page_uri( $page );
if ( ! in_array( $page_uri, array( 'journal', 'projects', 'music', 'podcasts', 'about' ), true ) ) {
return '';
}
return home_url( '/' . $page_uri . '/' );
}
/**
* Estimate localized reading time from stored post content without rendering it.
*