diff options
| Commit | 8afcd640327873a1c8bd6162785c050920566cf8 (patch) | |
|---|---|---|
| Author | 2020-07-15 09:33:12 +0300 | |
| Committer | 2020-07-15 09:33:12 +0300 | |
| Files | 7da1e3c64d1d115ceb51517b7931e4a7e6673178 /wp-content/themes/carmag/functions.php | |
| tues-interns-2020-feature/cookie-notice.tar tues-interns-2020-feature/cookie-notice.tar.gz tues-interns-2020-feature/cookie-notice.zip | ||
| Parent | 4d6f27167e27628c0a7ebc2b40eb01fd5b16597f (diff) | |
| Parent | 38f71eb84200aab19ae9f6e27102d05a10a6d0a1 (diff) | |
Sync feature/cookie-notice with the latest master and run Gulp for assets feature/cookie-notice
1 files changed, 13 insertions, 2 deletions
| -rw-r--r-- | wp-content/themes/carmag/functions.php | 15 |
diff --git a/wp-content/themes/carmag/functions.php b/wp-content/themes/carmag/functions.php index c40a666..5e52ddf 100644 --- a/wp-content/themes/carmag/functions.php +++ b/wp-content/themes/carmag/functions.php @@ -92,8 +92,19 @@ function carmag_setup() { // This theme uses wp_nav_menu() in one location. register_nav_menus( array( - 'primary' => esc_html__( 'Primary', 'carmag' ), - ) ); + 'primary' => esc_html__( 'Primary', 'carmag' ), + 'profile' => esc_html__( 'Profile', 'carmag' ), + ) ); + add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' ); + function my_dynamic_menu_items( $menu_items ) { + foreach ( $menu_items as $menu_item ) { + if ( strpos($menu_item->title, '#profile_name#') !== false) { + $menu_item->title = str_replace("#profile_name#", wp_get_current_user()->display_name, $menu_item->title); + } + } + + return $menu_items; + } /* * Switch default core markup for search form, comment form, and comments |
