File: /mnt/data/kofejob-wp/wp-content/themes/kofejob/template-parts/headers/header-1.php
<?php
$current_user_id = get_current_user_id();
$main_logo = kofejob_fl_framework_get_options('frontend_logo');
$img_id = $header_transparent_option = $header_size = $main_logo_url = '';
global $kofejob_theme_options;
$active_profile = get_user_meta($current_user_id,'_active_profile', true);
if(isset($main_logo) && $main_logo != '')
{
$main_logo_url = $main_logo['url'];
}
else
{
$main_logo_url = get_template_directory_uri().'/assets/images/logo-kofesvg.svg';
}
$img_id ='';
$emp_id = get_user_meta( $current_user_id, 'employer_id' , true );
$fre_id = get_user_meta( $current_user_id, 'freelancer_id' , true );
$header_width = kofejob_fl_framework_get_options('header_size');
$header_size = 'container';
if(isset($header_width) && $header_width == 1)
{
$header_size = 'container';
}
else if(isset($header_width) && $header_width == 0 )
{
$header_size = 'container-fluid';
}
$header_transparent = kofejob_fl_framework_get_options('header_transparent');
$page_id = get_the_ID();
if(isset($header_transparent) && $header_transparent == 1 || $page_id == '589')
{
$header_transparent_option = '';
}
else if(isset($header_transparent) && $header_transparent == 2 && is_page_template( 'page-home.php' ))
{
$header_transparent_option = 'transparent';
}
?>
<!-- Header -->
<header class="header <?php if(in_array('redux-framework/redux-framework.php', apply_filters('active_plugins', get_option('active_plugins'))))
{ if (is_front_page()) { ?> fixed <?php } } else { ?> default_front <?php } ?>">
<nav class="navbar navbar-expand-lg header-nav">
<div class="navbar-header">
<a id="mobile_btn" href="javascript:void(0);">
<span class="bar-icon">
<span></span>
<span></span>
<span></span>
</span>
</a>
<a class="navbar-brand logo" href="<?php echo esc_url( home_url( '/' ) ); ?>">
<img src="<?php echo esc_url($main_logo_url); ?>" class="img-fluid" alt="<?php echo get_post_meta($img_id, '_wp_attachment_image_alt', TRUE); ?>"/></a>
</div>
<div class="main-menu-wrapper">
<div class="menu-header">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="menu-logo">
<img src="<?php echo esc_url($main_logo_url); ?>" class="img-fluid" alt="<?php echo get_post_meta($img_id, '_wp_attachment_image_alt', TRUE); ?>"/>
</a>
<a id="menu_close" class="menu-close" href="javascript:void(0);">
<i class="fas fa-times"></i>
</a>
</div>
<!--Navigation menu-->
<?php
if ( has_nav_menu( 'header_menu' ) ) {
wp_nav_menu( array(
'theme_location' => 'header_menu',
'menu_id' => 'primary-menu',
'menu_class' => 'main-nav',
) );
} else {
wp_nav_menu( array(
'menu_id' => 'primary-menu',
'menu_class' => 'main-nav',
'items_wrap' => '<ul class="main-nav">%3$s</ul>'
) );
}
?>
<?php
$employer_btn_text_login = kofejob_fl_framework_get_options('employer_btn_text_login');
$freelancer_btn_text_login = kofejob_fl_framework_get_options('freelancer_btn_text_login');
if(is_user_logged_in()) {
if(isset($active_profile) && $active_profile == 1 || $active_profile == '')
{
if($employer_btn_text_login != '')
{
?>
<div class="fr-list nav-item dropdown header-navbar-rht createpost_mobile header-navbar-rht">
<a href="<?php echo esc_url(get_permalink(kofejob_fl_framework_get_options('add_listing_page'))) ?>?ext=create-project" class="login-btn style-1 "> <?php echo esc_html($employer_btn_text_login); ?></a>
</div>
<?php
}
}
}
?>
</div>
<?php
if(in_array('kofejob-core/kofejob-core.php', apply_filters('active_plugins', get_option('active_plugins'))))
{
?>
<ul class="nav header-navbar-rht">
<?php
if(isset($active_profile) && $active_profile == 1 )
{
if($employer_btn_text_login != '')
{
?>
<li class="fr-list createpost">
<a href="<?php echo esc_url(get_permalink(kofejob_fl_framework_get_options('add_listing_page'))) ?>?ext=create-project" class="login-btn style-1 "> <?php echo esc_html($employer_btn_text_login); ?> </a>
</li>
<?php
}
}
?>
<?php if(isset($kofejob_theme_options['kofejob_notifications']) && $kofejob_theme_options['kofejob_notifications'] == true)
{
if(is_user_logged_in()){
?>
<li class="nav-item dropdown has-arrow notification-click">
<a href="#" class="nav-link dropdown-toggle notification-click" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
<i class="far fa-bell"></i>
<span class="badge-container">
<?php
$notification = kofejob_notification_ajax('count');
if(isset($notification) && $notification > 0)
{
?>
<span class="badge bg-danger"><?php echo esc_html($notification); ?></span>
<?php
}
?>
</span>
</a>
<div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="dropdownMenuButton1">
<h5 class="notification-title"><?php echo esc_html__('Notifications', 'kofejob' ); ?></h5>
<div class="notification-list"><?php echo kofejob_get_notifications($current_user_id); ?></div>
<p class="notification-view-all"><a href="<?php echo esc_url(get_the_permalink($dashboard_page));?>/?ext=notifications"> <?php echo esc_html__('See all notifications', 'kofejob' ); ?></a></p>
</div>
</li>
<?php
}
}?>
<?php
$btn_text = kofejob_fl_framework_get_options('header_btn_text');
$Second_btn_text = kofejob_fl_framework_get_options('secondary_btn_text');
$employer_btn_text_login = kofejob_fl_framework_get_options('employer_btn_text_login');
$freelancer_btn_text_login = kofejob_fl_framework_get_options('freelancer_btn_text_login');
if( is_user_logged_in() )
{
?>
<li class="nav-item dropdown has-arrow main-drop account-item">
<?php
$dashboard_page = kofejob_fl_framework_get_options('user_dashboard_page');
$final_amount_html = $user_type = $user_name = $profile_image = '';
$is_wallet_active = kofejob_fl_framework_get_options('kofejob_wallet_system');
if(isset($is_wallet_active) && $is_wallet_active == 0)
{
$amount = get_user_meta( $current_user_id, '_fl_wallet_amount', true );
if(empty($amount))
{
$final_amout = 0;
}
else
{
$final_amout = $amount;
}
$final_amount_html = ' ( '.kofejob_fl_price_separator($final_amout).' )';
}
$profile_image = '';
if(isset($active_profile) && $active_profile == 1 )
{
$active_user = $emp_id;
$profile_image = kofejob_get_profile_img($active_user, "employer");
$user_name = kofejob_get_username('employer',$active_user );
$user_type = esc_html__('Employer','kofejob');
}
else if(isset($active_profile) && $active_profile == 2)
{
$active_user = $fre_id;
$user_name = kofejob_get_username('freelancer',$active_user );
$user_type = esc_html__('Freelancer','kofejob');
$profile_image = kofejob_get_profile_img($active_user, "freelancer");
}
?>
<a class="dropdown-toggle nav-link" data-bs-toggle="dropdown">
<span class="user-img">
<?php echo wp_return_echo($profile_image); ?>
</span>
<div class="user_info">
<span> <?php echo esc_html($user_name); ?></span>
<p class="mb-0"><small> <?php echo esc_html ($user_type); ?></small></p>
</div>
</a>
<div class="dropdown-menu emp">
<div class="drop-head"><?php echo esc_html__('Account Details', 'kofejob');?></div>
<a class="dropdown-item" href="<?php echo get_the_permalink($dashboard_page); ?>"><i class="material-icons">dashboard</i><?php echo get_the_title($dashboard_page); ?></a>
<?php
if(isset($active_profile) && $active_profile == 1 )
{ ?>
<a class="dropdown-item" href="<?php echo get_permalink($emp_id); ?>"><i class="material-icons">verified_user</i>
<?php echo esc_html__('View profile', 'kofejob');?></a>
<?php } ?>
<?php
if(isset($active_profile) && $active_profile == 2 )
{ ?>
<a class="dropdown-item" href="<?php echo get_permalink($fre_id); ?>"><i class="material-icons">verified_user</i>
<?php echo esc_html__('View profile', 'kofejob');?></a>
<?php } ?>
<div class="drop-head"><?php echo esc_html__('Projects Settings', 'kofejob');?></div>
<a class="dropdown-item" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_listing_page')));?>?ext=ongoing-project"><i class="material-icons">business_center</i> <?php echo get_the_title(kofejob_fl_framework_get_options('my_listing_page')); ?></a>
<?php if(isset($active_profile) && $active_profile == 2){ ?>
<a class="dropdown-item" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_favourites_page')));?>?ext=followed-employers"><i class="material-icons">local_play</i> <?php echo get_the_title(kofejob_fl_framework_get_options('my_favourites_page')); ?></a>
<?php } ?>
<?php if(isset($active_profile) && $active_profile == 1){ ?>
<a class="dropdown-item" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_favourites_page')));?>?ext=followed-employers"><i class="material-icons">local_play</i> <?php echo get_the_title(kofejob_fl_framework_get_options('my_favourites_page')); ?></a>
<?php } ?>
<?php if(isset($active_profile) && $active_profile == 2){ ?>
<a class="dropdown-item" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_reviews_page')));?>?ext=my-ratings"><i class="material-icons">pie_chart</i> <?php echo get_the_title(kofejob_fl_framework_get_options('my_reviews_page')); ?></a>
<?php } ?>
<div class="drop-head"><?php echo esc_html__('Financial Settings', 'kofejob');?></div>
<?php
if(isset($is_wallet_active) && $is_wallet_active == 0)
{
?>
<?php if(isset($active_profile) && $active_profile == 1){ ?>
<a class="dropdown-item bal" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_payments_page')));?>?ext=statements"><i class="material-icons">payment</i> <?php echo esc_html__('Balance', 'kofejob');?> <span class="amt ml-1"><?php echo esc_html(kofejob_fl_price_separator($final_amout)); ?></span></a>
<?php } ?>
<?php if(isset($active_profile) && $active_profile == 2){ ?>
<a class="dropdown-item bal" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_payments_page')));?>?ext=invoices"><i class="material-icons">payment</i> <?php echo esc_html__('Balance', 'kofejob');?> <span class="amt ml-1"><?php echo esc_html(kofejob_fl_price_separator($final_amout)); ?></span></a>
<?php } ?>
<?php
} ?>
<?php if(isset($active_profile) && $active_profile == 2){ ?>
<a class="dropdown-item" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_payments_page')));?>?ext=payouts"><i class="material-icons">wifi_tethering</i> <?php echo esc_html__('Withdraw funds', 'kofejob');?></a>
<?php
} ?>
<div class="drop-head"><?php echo esc_html__('Account Settings', 'kofejob');?></div>
<a class="dropdown-item" href="<?php echo esc_url(get_the_permalink(kofejob_fl_framework_get_options('my_profile_page')));?>?ext=edit-profile"> <i class="material-icons">settings</i> <?php echo get_the_title(kofejob_fl_framework_get_options('my_profile_page')); ?></a>
<a class="dropdown-item" href="<?php echo wp_logout_url( get_the_permalink( $kofejob_theme_options['login_page'] ) ); ?>"><i class="material-icons">power_settings_new</i> <?php echo esc_html__('Logout', 'kofejob');?></a>
<ul>
<?php
if(isset($kofejob_theme_options['user_registration_type']) && $kofejob_theme_options['user_registration_type'] == 'both')
{
?>
<li>
<a class="dropdown-item profile_selection <?php if(isset($active_profile) && $active_profile == 2) { echo 'selected'; } ?>" data-profile-active="freelancer" href="javascript:void(0)">
<span class="profile-img">
<?php
$pro_img_id = get_post_meta( $fre_id, '_profile_pic_freelancer_id', true );
$pro_img = wp_get_attachment_image_src( $pro_img_id, 'thumbnail' );
if(wp_attachment_is_image($pro_img_id))
{
?>
<img src="<?php echo esc_url($pro_img[0]); ?>" alt="<?php echo esc_attr(get_post_meta($pro_img_id, '_wp_attachment_image_alt', TRUE)); ?>" class="img-fluid">
<?php
}
else
{
?>
<img src="<?php echo esc_url($kofejob_theme_options['freelancer_df_img']['url']); ?>" alt="<?php echo esc_attr(get_post_meta($img_id, '_wp_attachment_image_alt', TRUE)); ?>" class="img-fluid">
<?php
}
?>
</span>
<span>
<h4>
<?php
if (strlen(esc_attr(get_post_meta( $fre_id, '_freelancer_dispaly_name' , true ))) > 20)
{
echo substr(kofejob_get_username('freelancer',$fre_id ), 0, 20) . ' ...';
}
else
{
echo kofejob_get_username('freelancer',$fre_id );
}
?>
</h4>
<p><?php echo esc_html__('Freelancer','kofejob'); ?></p>
</span>
</a>
</li>
<li>
<a class="dropdown-item <?php if(isset($active_profile) && $active_profile == 1) { echo 'selected'; } else if(empty($active_profile)) { echo 'selected'; } ?> profile_selection" data-profile-active="employer" href="javascript:void(0)">
<span class="profile-img">
<?php
$pro_img_id = get_post_meta( $emp_id, '_profile_pic_attachment_id', true );
$pro_img = wp_get_attachment_image_src( $pro_img_id, 'thumbnail' );
if(wp_attachment_is_image($pro_img_id))
{
?>
<img src="<?php echo esc_url($pro_img[0]); ?>" alt="<?php echo esc_attr(get_post_meta($pro_img_id, '_wp_attachment_image_alt', TRUE)); ?>" class="img-fluid">
<?php
}
else
{
?>
<img src="<?php echo esc_url($kofejob_theme_options['employer_df_img']['url']); ?>" alt="<?php echo esc_attr(get_post_meta($img_id, '_wp_attachment_image_alt', TRUE)); ?>" class="img-fluid">
<?php
}
?>
</span>
<span>
<h4>
<?php
if (strlen(esc_attr(get_post_meta( $emp_id, '_employer_dispaly_name' , true ))) > 20)
{
echo substr(kofejob_get_username('employer',$emp_id ), 0, 20) . ' ...';
}
else
{
echo kofejob_get_username('employer',$emp_id );
}
?>
</h4>
<p><?php echo esc_html__('Employer','kofejob'); ?></p>
</span>
</a>
</li>
<?php
}
?>
</ul>
</div>
</li>
<?php
if(isset($active_profile) && $active_profile == 2)
{
if($freelancer_btn_text_login != '')
{
?>
<li class="fr-list">
<a href="<?php echo kofejob_fl_framework_get_options('freelancer_btn_page_login'); ?>" class="login-btn style-1"><?php echo esc_html($freelancer_btn_text_login); ?></a>
</li>
<?php
}
}
?>
<?php
}
else
{
?>
<li class="fr-list">
<?php
if($Second_btn_text != '')
{
?>
<a href="<?php echo get_the_permalink(kofejob_fl_framework_get_options('secondary_btn_page')); ?>" class="style-1 reg-btn"><i class="fas fa-user me-2"></i><?php echo esc_html($Second_btn_text); ?> </a>
<?php
}
?>
</li>
<li>
<?php if($btn_text != '')
{
?>
<a href="<?php echo get_the_permalink(kofejob_fl_framework_get_options('header_btn_page')); ?>" class="log-btn"><i class="fas fa-lock me-2"></i><?php echo esc_html($btn_text); ?></a>
<?php
}
?>
</li>
<?php
}
?>
</ul>
<?php } ?>
</nav>
</header>