From 38f71eb84200aab19ae9f6e27102d05a10a6d0a1 Mon Sep 17 00:00:00 2001 From: Ivan Dimitrov Date: Wed, 15 Jul 2020 09:30:00 +0300 Subject: Feature/header - logged in (#102) * [Update] Styled the header and made it responsive. Changed primary colors. * [Update] Cleaned _header.scss * [Update] all buttons styles * [Update] Merged feature/button-styles, fixed responsive design and fixed #34 #36 #37 #39 * header: remove the duplicated master.css load. We have a function in functions.php which handles the load of the assets files * [Fix] Fixed header logo, register and login buttons classnames handled by wordpress * [Fix] Fixed long word link content breaking down and fixed separator disappearing * [Fix] Fixed logo margin when it is p tag * [Update] Added 'profile' menu when the user is logged in Co-authored-by: Valentin Co-authored-by: metodiew --- wp-content/themes/carmag/functions.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'wp-content/themes/carmag/functions.php') 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 -- cgit v1.3.1-26-gb76a