/**
 * function to handle button actions and redirection to relevant pages
 */
function consultants_page()
{
    if (isset($_GET['action']) && $_GET['action'] == 'add') {
        require get_template_directory() . '/settings/pages/consultant_add.php';
    } elseif (isset($_GET['action']) && $_GET['action'] == 'edit') {
        require get_template_directory() . '/settings/pages/consultant_update.php';
    } elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id'])) {
        $consultants = new Consultants();
        $consultants->delete($_GET['id']);
        require get_template_directory() . '/settings/pages/consultant.php';
    } else {
        require get_template_directory() . '/settings/pages/consultant.php';
    }
}

<div class="wrap">
    
    <div id="icon-options-general" class="icon32"></div>
    
    <a href ="edit.php?post_type=job&page=consultants" class="button button-primary">Back</a>   <h1>Update Consultant</h1>

    
    <?php 
$error = 0;
$error_msg = array();
$consultants = new Consultants();
$validations = new Validations();
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $data = $consultants->getUserById($id);
}
if (isset($_POST['submit'])) {
    if (!$validations->stringCheck($_POST['firstname'])) {
        $error++;
        $error_msg[] = 'Please check firstname!';
    }
    if (!$validations->stringCheck($_POST['lastname'])) {
        $error++;
        $error_msg[] = 'Please check lastname!';
    }
    if ($consultants->isUsernameExist($_POST['email'], $_POST['id'])) {
        $error++;
        $error_msg[] = 'Please check email!';
    }
<?php

if (isset($_GET['rec_listner']) && $_GET['rec_listner'] == 'admin') {
    if (isset($_GET['type']) && $_GET['type'] == 'consultants') {
        $consultants = new Consultants();
        $data = $consultants->getUsersJson();
        if (!empty($data)) {
            echo $data;
            exit;
        }
    }
    exit;
}
 <?php 
$consultants = new Consultants();
$users = $consultants->getUsersJson();
echo $users;

<div class="wrap">
    
    <div id="icon-options-general" class="icon32"></div>
    
    <a href ="edit.php?post_type=job&page=consultants" class="button button-primary">Back</a>   <h1>Add Consultant</h1>

    <?php 
$error = 0;
$error_msg = array();
$consultants = new Consultants();
$validations = new Validations();
if (isset($_POST['submit'])) {
    if (!$validations->stringCheck($_POST['firstname'])) {
        $error++;
        $error_msg[] = 'Please check firstname!';
    }
    if (!$validations->stringCheck($_POST['lastname'])) {
        $error++;
        $error_msg[] = 'Please check lastname!';
    }
    if (!$validations->emailCheck($_POST['email'])) {
        $error++;
        $error_msg[] = 'Please check email!';
    }
    if ($consultants->isUsernameExist($_POST['email'])) {
        $error++;
        $error_msg[] = 'Email already exists!';
    }
}
<?php

//echo '<pre>'.print_r( wp_get_nav_menu_items( 2 ) ,1).'</pre>';
?>
<!DOCTYPE html>

<?php 
$consultants = new Consultants();
$validations = new Validations();
if (isset($_POST['submit'])) {
    if (!$validations->emailCheck($_POST['username'])) {
        $error++;
        $error_msg = 'Wrong username/password!';
    }
    if (!$consultants->loginUser($_POST['username'], $_POST['password'])) {
        $error++;
        $error_msg = 'Wrong username/password!';
        $showlogin = '******';
    }
}
?>
<html lang="en-US" class="css3transitions">
<html <?php 
language_attributes();
?>
>
<head>