diff options
| Commit | fb093e569036dcb0200afabdb29c83bc2db783d2 (patch) | |
|---|---|---|
| Author | 2020-07-15 10:10:01 +0300 | |
| Committer | 2020-07-15 10:10:01 +0300 | |
| Files | 71ee31bf39565ea6cff7b88b312bf430cf66248b /wp-content/themes/carmag/functions.php | |
| tues-interns-2020-feature/registration.tar tues-interns-2020-feature/registration.tar.gz tues-interns-2020-feature/registration.zip | ||
| Parent | c09cfaaff21afdf1fa43aa81327611d3f848e7eb (diff) | |
| Parent | 860e362739eee6867b6617320ec9eae81865140a (diff) | |
Sync feature/registration with the latest master feature/registration
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 |
