[FRAMEWORK] Xây dựng page Account Phần 1 (ok)

Làm phần ứng dụng Framework

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\init.php

<?php
require get_template_directory() . '/framework/framework.php';
global $bj_controller;
$bj_controller = new BJ_Controller();
require get_template_directory() . '/framework/ajax/account.php';

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\ajax\account.php

<?php
/**
 * App Update Info
 */
add_action('wp_ajax_app_update_info', 'app_update_info');
function app_update_info() {
  check_ajax_referer(AT_NONCE_KEY . 'update-info', 'update-info-token');
  $status   = false;
  $message  = '';
  $username = sanitize_text_field($_POST['username']);
  $phone    = sanitize_text_field($_POST['phone']);
  $email    = sanitize_text_field($_POST['email']);
  $language = sanitize_text_field($_POST['language']);
  $province = intval($_POST['province']);
  $district = intval($_POST['district']);
  $ward     = intval($_POST['ward']);
  $street   = sanitize_text_field($_POST['street']);
  global $current_user;
  $current_email            = $current_user->user_email;
  $current_user_id          = $current_user->ID;
  $data_user_for_update_arr = array(
    'ID'           => $current_user_id,
    'display_name' => $username,
  );
  $province_address = array(
    'province' => $province,
    'district' => $district,
    'ward'     => $ward,
    'street'   => $street,
  );
  $province_address = json_encode($province_address, JSON_UNESCAPED_UNICODE);
  if ($current_email != $email) {
    if (email_exists($email)) {
      $status  = true;
      $message = __("Email already exists", "umm");
    } elseif (!is_email($email)) {
      $status  = true;
      $message = __("Invalid email", "umm");
    } else {
      $data_user_for_update_arr["user_email"] = $email;
    }
  }
  if (!$status) {
    wp_update_user($data_user_for_update_arr);
    update_user_meta($current_user_id, 'user_phone', $phone);
    update_user_meta($current_user_id, 'language', $language);
    update_user_meta($current_user_id, "province_address", $province_address);
  }
  if (isset($_FILES["image-avarta"]) && !empty($_FILES['image-avarta']['name'])) {
    $result_upload = upload_image($_FILES["image-avarta"]);
    if ($result_upload['status'] == 'success') {
      $id_avatar_curr = get_user_meta($current_user_id, 'id_img_avatar', true);
      if ($id_avatar_curr) {
        delete_img_by_id($id_avatar_curr);
      }
      update_user_meta($current_user_id, 'id_img_avatar', $result_upload['content']);
    } else {
      $message = __("upload error ", "umm");
      $status  = true;
    }
  }
  echo json_encode(array(
    'status'  => $status,
    'message' => $message)
  );
  die();
}

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\framework.php

<?php
class Pv_Controller {
  public function load() {
    global $bj_controller;
    return $bj_controller;
  }
}
class BJ_Controller {
  public function Controller($file_name = "") {
    $obj      = new stdClass();
    $file_url = "controllers/" . $file_name . ".php";
    require_once $file_url;
    $controller_name = "BJ_" . $file_name . "_Controller";
    $obj             = new $controller_name();
    return $obj;
  }
  public function Model($file_name = "") {
    $obj      = new stdClass();
    $file_url = "models/" . $file_name . ".php";
    require_once $file_url;
    $model_name = "BJ_" . $file_name . "_Model";
    $obj        = new $model_name();
    return $obj;
  }
  public function View($file_name = "", $data = array(), $path = "") {
    $file_name = $path . "/" . $file_name;
    get_template_part("framework/views/" . $file_name, "", $data);
  }
  public function View_be($file_name = "", $data = array(), $path = "") {
    $file_name = $path . "/" . $file_name;
    get_template_part("framework/views/backend/" . $file_name, "", $data);
  }
}

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\functions.php

<?php
add_action('after_setup_theme', 'blankslate_setup');
function blankslate_setup() {
  load_theme_textdomain('blankslate', get_template_directory() . '/languages');
  add_theme_support('title-tag');
  add_theme_support('post-thumbnails');
  add_theme_support('responsive-embeds');
  add_theme_support('automatic-feed-links');
  add_theme_support('html5', array('search-form', 'navigation-widgets'));
  add_theme_support('woocommerce');
  global $content_width;
  if (!isset($content_width)) {$content_width = 1920;}
  register_nav_menus(array('main-menu' => esc_html__('Main Menu', 'blankslate')));
}
add_filter('document_title_separator', 'blankslate_document_title_separator');
function blankslate_document_title_separator($sep) {
  $sep = esc_html('|');
  return $sep;
}
add_filter('the_title', 'blankslate_title');
function blankslate_title($title) {
  if ($title == '') {
    return esc_html('...');
  } else {
    return wp_kses_post($title);
  }
}
function blankslate_schema_type() {
  $schema = 'https://schema.org/';
  if (is_single()) {
    $type = "Article";
  } elseif (is_author()) {
    $type = 'ProfilePage';
  } elseif (is_search()) {
    $type = 'SearchResultsPage';
  } else {
    $type = 'WebPage';
  }
  echo 'itemscope itemtype="' . esc_url($schema) . esc_attr($type) . '"';
}
add_filter('nav_menu_link_attributes', 'blankslate_schema_url', 10);
function blankslate_schema_url($atts) {
  $atts['itemprop'] = 'url';
  return $atts;
}
if (!function_exists('blankslate_wp_body_open')) {
  function blankslate_wp_body_open() {
    do_action('wp_body_open');
  }
}
add_action('wp_body_open', 'blankslate_skip_link', 5);
function blankslate_skip_link() {
  echo '<a href="#content" class="skip-link screen-reader-text">' . esc_html__('Skip to the content', 'blankslate') . '</a>';
}
add_filter('the_content_more_link', 'blankslate_read_more_link');
function blankslate_read_more_link() {
  if (!is_admin()) {
    return ' <a href="' . esc_url(get_permalink()) . '" class="more-link">' . sprintf(__('...%s', 'blankslate'), '<span class="screen-reader-text">  ' . esc_html(get_the_title()) . '</span>') . '</a>';
  }
}
add_filter('excerpt_more', 'blankslate_excerpt_read_more_link');
function blankslate_excerpt_read_more_link($more) {
  if (!is_admin()) {
    global $post;
    return ' <a href="' . esc_url(get_permalink($post->ID)) . '" class="more-link">' . sprintf(__('...%s', 'blankslate'), '<span class="screen-reader-text">  ' . esc_html(get_the_title()) . '</span>') . '</a>';
  }
}
add_filter('big_image_size_threshold', '__return_false');
add_filter('intermediate_image_sizes', 'remove_default_img_sizes', 10, 1);
function remove_default_img_sizes($sizes) {
  $targets = ['medium_large', 'large', '1536x1536', '2048x2048', 'woocommerce_thumbnail', 'woocommerce_single', 'woocommerce_gallery_thumbnail', 'shop_catalog', 'shop_single', 'shop_thumbnail'];
  foreach ($sizes as $size_index => $size) {
    if (in_array($size, $targets)) {
      unset($sizes[$size_index]);
    }
  }
  return $sizes;
}
// == Start Script
add_action('wp_enqueue_scripts', 'ecademy_enqueue_style');
function ecademy_enqueue_style() {
  wp_enqueue_script('jquery');
  wp_enqueue_style("custom_css", get_stylesheet_directory_uri() . "/css/custom.css", array(), '1.1.0', 'all');
  $script_data_array = array(
    'ajaxurl'  => admin_url('admin-ajax.php'),
    'security' => wp_create_nonce('file_upload'),
  );
  wp_enqueue_script('custom_js', get_stylesheet_directory_uri() . '/js/custom.js', array('jquery'), '123', 'all', true);
  wp_localize_script('custom_js', 'app', $script_data_array);
}
function wpdocs_selectively_enqueue_admin_script($hook) {
  wp_enqueue_script('custom_js', get_stylesheet_directory_uri() . '/js/admin.js', array('jquery'), '123', 'all', true);
  wp_enqueue_style("custom_css", get_stylesheet_directory_uri() . "/css/admin.css", array(), '1.1.0', 'all');
}
add_action('admin_enqueue_scripts', 'wpdocs_selectively_enqueue_admin_script');
// == End Script
// Start App
require get_template_directory() . '/inc/define.php';
require get_template_directory() . '/framework/init.php';
require get_template_directory() . '/inc/functions/function-setup.php';
require get_template_directory() . '/inc/functions/function-global.php';
// End App

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\inc\define.php

<?php
define('AT_NONCE_KEY', "ATWeb@NOCEummV1");
if (!defined('THEME_DIR_PATH')) {
  define('THEME_DIR_PATH', untrailingslashit(get_template_directory()));
}
if (!defined('THEME_VERSION')) {
  define('THEME_VERSION', wp_get_theme(get_template())->get('Version'));
}
define('THEME_URL', trailingslashit(esc_url(get_template_directory_uri())));
define('SITE_URL', trailingslashit(esc_url(get_site_url())));
if (!defined('BANNER_DF')) {
  define('BANNER_DF', THEME_URL . 'images/item-group.png');
}
if (!defined('AVATAR_DF')) {
  define('AVATAR_DF', THEME_URL . 'images/avatar.jpg');
}
define('USER', "subscriber");

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\inc\functions\function-setup.php

<?php
add_filter('use_block_editor_for_post', '__return_false');
if (!is_super_admin()) {
  /* Disable Admin Bar */
  add_filter('show_admin_bar', '__return_false');
}
function at_umm_setup() {
  add_theme_support('title-tag');
  /* load theme languages */
  //load_theme_textdomain('umm', get_template_directory() . '/languages');
  /* Add support for post thumbnails */
  add_theme_support('post-thumbnails');
  /* Add support for HTML5 */
  add_theme_support('html5', array(
    'search-form',
    'comment-form',
    'comment-list',
    'gallery',
    'caption',
    'widgets',
  ));
  /*  Enable support for Post Formats */
  add_theme_support( 'post-formats', array( 'video' ) );
}
add_action('after_setup_theme', 'at_umm_setup');
/**
 * Setup Styles and Scripts
 */
function at_umm_scripts() {
  wp_dequeue_style('wp-block-library'); // remove block-library/style.min.css
  // add Styles.
  wp_enqueue_style('umm-main-css', THEME_URL . 'css/app.min.css', array(), THEME_VERSION, 'all');
  // add Scripts
  wp_enqueue_script('umm-main-js', THEME_URL . 'js/frontend.js', array('jquery'), THEME_VERSION, true);
  // Add variables to scripts.
  $php_var_array = array(
    'ajaxUrl'        => admin_url('admin-ajax.php'),
    'siteUrl'        => home_url(),
    'follow'         => __('Follow', 'umm'),
    'unfollow'       => __('Unfollow', 'umm'),
    'appoint_admin'  => __('Appoint as admin', 'umm'),
    'appoint_member' => __('Appoint as member ', 'umm'),
    'admin'          => __('admin', 'umm'),
    'member'         => __('member', 'umm'),
    'mute_on'        => __('Turn on notification', 'umm'),
    'mute_off'       => __('Mute notification', 'umm'),
    'business'       => __('Business', 'umm'),
    'activity'       => __('Activity', 'umm'),
    'sent'           => __('Sent', 'umm'),
  );
  wp_localize_script('umm-main-js', 'app', $php_var_array);
}
add_action('wp_enqueue_scripts', 'at_umm_scripts', 100);
/**
 * admin stylesheet
 */
add_action('admin_enqueue_scripts', 'adimin_enqueue_js');
function adimin_enqueue_js() {
  if (!did_action('wp_enqueue_media')) {
    wp_enqueue_media();
  }
  wp_register_script('admin_js', THEME_URL . '/js/backend.js', array('jquery'), 1.0);
  wp_enqueue_script('admin_js');
  wp_enqueue_style('admin-css', THEME_URL . '/css/admin-styles.css', false, 1.0);
}
/**
 * Remove jquery-migrate
 */
function dequeue_jquery_migrate($scripts) {
  if (!is_admin() && !empty($scripts->registered['jquery'])) {
    $scripts->registered['jquery']->deps = array_diff(
      $scripts->registered['jquery']->deps,
      ['jquery-migrate']
    );
  }
}
add_action('wp_default_scripts', 'dequeue_jquery_migrate');
/**
 * Remove wp-embed
 */
function my_deregister_scripts() {
  wp_dequeue_script('wp-embed');
}
add_action('wp_footer', 'my_deregister_scripts');
/**
 * Disable the emoji's
 */
function disable_emojis() {
  remove_action('wp_head', 'print_emoji_detection_script', 7);
  remove_action('admin_print_scripts', 'print_emoji_detection_script');
  remove_action('wp_print_styles', 'print_emoji_styles');
  remove_action('admin_print_styles', 'print_emoji_styles');
  remove_filter('the_content_feed', 'wp_staticize_emoji');
  remove_filter('comment_text_rss', 'wp_staticize_emoji');
  remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
  // Remove from TinyMCE
  add_filter('tiny_mce_plugins', 'disable_emojis_tinymce');
}
add_action('init', 'disable_emojis');
/**
 * Filter out the tinymce emoji plugin.
 */
function disable_emojis_tinymce($plugins) {
  if (is_array($plugins)) {
    return array_diff($plugins, array('wpemoji'));
  } else {
    return array();
  }
}
/**
 *
 * Set load languages
 *
 */
add_filter('locale', 'at_switch_language');
function at_switch_language($locale) {
  //return 'en_US';
  if (!is_admin()) {
    if (isset($_COOKIE['app_language'])) {
      return $_COOKIE['app_language'];
    }
    return 'en_US';
  }
}

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\inc\functions\function-global.php

<?php
/**
 *
 * @return HTML - option list tỉnh thành
 */
function reder_province_option($default = "") {
  $json_file = get_stylesheet_directory() . "/json/tinh_tp.json";
  if (file_exists($json_file)) {
    $json       = file_get_contents($json_file);
    $tinh_thanh = json_decode($json, true);
    foreach ($tinh_thanh as $key => $value) {
      if ($key == $default) {$select = "selected";} else { $select = "";}
      echo "<option " . $select . " value='" . $key . "'>" . $value["name"] . "</option>";
    }
  }
}
/**
 * @return HTML - option list quận huyện
 */
function reder_quan_huyen_option($tinh_thanh, $default) {
  $default    = sprintf('%02d', intval($default));
  $tinh_thanh = sprintf('%02d', intval($tinh_thanh));
  $json_file  = get_stylesheet_directory() . "/json/quan-huyen/" . $tinh_thanh . ".json";
  if (file_exists($json_file)) {
    $json       = file_get_contents($json_file);
    $quan_huyen = json_decode($json, true);
    foreach ($quan_huyen as $key => $value) {
      if ($key == $default) {
        $select = "selected";
      } else {
        $select = "";
      }
      echo "<option " . $select . " value='" . $key . "'>" . $value["name_with_type"] . "</option>";
    }
  }
}
/**
 * @return HTML - option list xã phường
 */
function reder_xa_phuong_option($quan_huyen, $default) {
  $default    = intval($default);
  $quan_huyen = sprintf('%03d', intval($quan_huyen));
  $json_file  = get_stylesheet_directory() . "/json/xa-phuong/" . $quan_huyen . ".json";
  if (file_exists($json_file)) {
    $json      = file_get_contents($json_file);
    $xa_phuong = json_decode($json, true);
    foreach ($xa_phuong as $key => $value) {
      if ($key == $default) {$select = "selected";} else { $select = "";}
      echo "<option " . $select . " value='" . $key . "'>" . $value["name_with_type"] . "</option>";
    }
  }
}
/**
 * AJAX load quận huyện khi select tỉnh thành phố
 */
add_action('wp_ajax_load_quan_huyen', 'load_quan_huyen');
function load_quan_huyen() {
  $tinh_thanh = $_POST['id'];
  $type       = $_POST['type'];
  $json_file  = get_stylesheet_directory() . "/json/quan-huyen/" . $tinh_thanh . ".json";
  if (file_exists($json_file)) {
    $json       = file_get_contents($json_file);
    $quan_huyen = json_decode($json, true);
    echo '<option value="" disabled selected >' . __("Select", "golf") . '</option>';
    foreach ($quan_huyen as $key => $value) {
      if ($type) {
        echo "<option value='" . $value["name_with_type"] . "'>" . $value["name_with_type"] . "</option>";
      } else {
        echo "<option value='" . $key . "'>" . $value["name_with_type"] . "</option>";
      }
    }
  }
  die();
}
/**
 * AJAX load danh sách xã phường khi select tỉnh thành phố
 */
add_action('wp_ajax_load_xa_phuong', 'load_xa_phuong');
function load_xa_phuong() {
  $quan_huyen = $_POST['id'];
  $json_file  = get_stylesheet_directory() . "/json/xa-phuong/" . $quan_huyen . ".json";
  if (file_exists($json_file)) {
    $json      = file_get_contents($json_file);
    $xa_phuong = json_decode($json, true);
    foreach ($xa_phuong as $key => $value) {
      echo "<option value='" . $key . "'>" . $value["name_with_type"] . "</option>";
    }
  }
  die();
}
/**
 *
 * Get địa chỉ của user bởi id
 * Nếu chưa update địa chỉ, thì gán mặc định là: '90 Đường Lê Lợi, Phường Bến Thành, Quận 1, Thành phố Hồ Chí Minh'
 */
function get_address_by_id_user($user_id = null) {
  if (!$user_id) {
    $user_id = get_current_user_id();
  }
  $province_address = get_user_meta($user_id, "province_address", true);
  if ($province_address) {
    return json_decode($province_address, true);
  }
  return array(
    'province' => 79,
    'district' => 760,
    'ward'     => 26743,
    'street'   => '90 Đường Lê Lợi',
  );
}
/**
 * Get địa chỉ text
 * @return array
 */
function atw_load_province_address($user_id = null) {
  $province = '';
  $district = '';
  $ward     = '';
  if (!$user_id) {
    $user_id = get_current_user_id();
  }
  $province_address = get_address_by_id_user($user_id);
  if ($province_address && is_array($province_address)) {
    $json_file = get_stylesheet_directory() . "/json/tinh_tp.json";
    if (file_exists($json_file)) {
      $json_tinh_tp = file_get_contents($json_file);
      $tinh_thanh   = json_decode($json_tinh_tp, true);
      foreach ($tinh_thanh as $key => $value) {
        if ($key == $province_address['province']) {
          $province = $tinh_thanh[$key]['name'];
          break;
        }
      }
    }
    if ($province_address['province']):
      $json_file = get_stylesheet_directory() . "/json/quan-huyen/" . $province_address['province'] . ".json";
      if (file_exists($json_file)) {
        $json_quan_huyen = file_get_contents($json_file);
        $quan_huyen      = json_decode($json_quan_huyen, true);
        foreach ($quan_huyen as $key => $value) {
          if ($key == $province_address['district']) {
            $district = $quan_huyen[$key]['name_with_type'];
            break;
          }
        }
      }
    endif;
    if ($province_address['district']):
      $json_file = get_stylesheet_directory() . "/json/xa-phuong/" . $province_address['district'] . ".json";
      if (file_exists($json_file)) {
        $json_xa_phuong = file_get_contents($json_file);
        $xa_phuong      = json_decode($json_xa_phuong, true);
        foreach ($xa_phuong as $key => $value) {
          if ($key == $province_address['ward']) {
            $ward = $xa_phuong[$key]['name_with_type'];
            break;
          }
        }
      }
    endif;
  }
  return array(
    'province' => $province,
    'district' => $district,
    'ward'     => $ward,
    'street'   => $province_address['street'],
  );
}
/**
 *
 * Crop image
 */
function resize_image($method, $image_loc, $new_loc, $width, $height) {
  $exif = exif_read_data($image_loc);
  if (isset($exif['Orientation']) && $exif['Orientation'] === 6) {
    $rotate = -90;
  } else if (isset($exif['Orientation']) && $exif['Orientation'] === 3) {
    $rotate = 180;
  } else if (isset($exif['Orientation']) && $exif['Orientation'] === 8) {
    $rotate = 90;
  }
  if (!is_array(@$GLOBALS['errors'])) {$GLOBALS['errors'] = array();}
  if (!in_array($method, array('force', 'max', 'crop'))) {$GLOBALS['errors'][] = 'Invalid method selected.';}
  if (!$image_loc) {$GLOBALS['errors'][] = 'No source image location specified.';} else {
    if ((substr(strtolower($image_loc), 0, 7) == 'http://') || (substr(strtolower($image_loc), 0, 7) == 'https://')) { /*don't check to see if file exists since it's not local*/} elseif (!file_exists($image_loc)) {$GLOBALS['errors'][] = 'Image source file does not exist.';}
    $extension = strtolower(substr($image_loc, strrpos($image_loc, '.')));
    if (!in_array($extension, array('.jpg', '.jpeg', '.png', '.gif', '.bmp'))) {$GLOBALS['errors'][] = 'Invalid source file extension!';}
  }
  if (!$new_loc) {$GLOBALS['errors'][] = 'No destination image location specified.';} else {
    $new_extension = strtolower(substr($new_loc, strrpos($new_loc, '.')));
    if (!in_array($new_extension, array('.jpg', '.jpeg', '.png', '.gif', '.bmp'))) {$GLOBALS['errors'][] = 'Invalid destination file extension!';}
  }
  $width = abs(intval($width));
  if (!$width) {$GLOBALS['errors'][] = 'No width specified!';}
  $height = abs(intval($height));
  if (!$height) {$GLOBALS['errors'][] = 'No height specified!';}
  if (count($GLOBALS['errors']) > 0) {echo_errors();return false;}
  if (in_array($extension, array('.jpg', '.jpeg'))) {$image = @imagecreatefromjpeg($image_loc);} elseif ($extension == '.png') {$image = @imagecreatefrompng($image_loc);} elseif ($extension == '.gif') {$image = @imagecreatefromgif($image_loc);} elseif ($extension == '.bmp') {$image = @imagecreatefromwbmp($image_loc);}
  if (!$image) {$GLOBALS['errors'][] = 'Image could not be generated!';} else {
    $current_width  = imagesx($image);
    $current_height = imagesy($image);
    if ((!$current_width) || (!$current_height)) {$GLOBALS['errors'][] = 'Generated image has invalid dimensions!';}
  }
  if (count($GLOBALS['errors']) > 0) {
    @imagedestroy($image);
    echo_errors();return false;}
  if ($method == 'force') {$new_image = resize_image_force($image, $width, $height);} elseif ($method == 'max') {$new_image = resize_image_max($image, $width, $height);} elseif ($method == 'crop') {$new_image = resize_image_crop($image, $width, $height);}
  if ((!$new_image) && (count($GLOBALS['errors'] == 0))) {$GLOBALS['errors'][] = 'New image could not be generated!';}
  if (count($GLOBALS['errors']) > 0) {
    @imagedestroy($image);
    echo_errors();return false;}
  $save_error = false;
  if (in_array($extension, array('.jpg', '.jpeg'))) {
    if (isset($rotate)) {$new_image = imagerotate($new_image, $rotate, 0);}
    imagejpeg($new_image, $new_loc) or ($save_error = true);} elseif ($extension == '.png') {
    if (isset($rotate)) {$new_image = imagerotate($new_image, $rotate, 0);}
    imagepng($new_image, $new_loc) or ($save_error = true);} elseif ($extension == '.gif') {imagegif($new_image, $new_loc) or ($save_error = true);} elseif ($extension == '.bmp') {imagewbmp($new_image, $new_loc) or ($save_error = true);}
  if ($save_error) {$GLOBALS['errors'][] = 'New image could not be saved!';}
  if (count($GLOBALS['errors']) > 0) {
    @imagedestroy($image);@imagedestroy($new_image);
    echo_errors();return false;}
  imagedestroy($image);
  imagedestroy($new_image);
  return true;
}
function echo_errors() {
  if (!is_array(@$GLOBALS['errors'])) {$GLOBALS['errors'] = array('Unknown error!');}
  foreach ($GLOBALS['errors'] as $error) {echo '<p style="color:red;font-weight:bold;">Error: ' . $error . '</p>';}
}
function resize_image_force($image, $width, $height) {
  $w = @imagesx($image); //current width
  $h = @imagesy($image); //current height
  if ((!$w) || (!$h)) {$GLOBALS['errors'][] = 'Image couldn\'t be resized because it wasn\'t a valid image.';return false;}
  if (($w == $width) && ($h == $height)) {return $image;} //no resizing needed
  $image2 = imagecreatetruecolor($width, $height);
  imagecopyresampled($image2, $image, 0, 0, 0, 0, $width, $height, $w, $h);
  return $image2;
}
function resize_image_max($image, $max_width, $max_height) {
  $w = imagesx($image); //current width
  $h = imagesy($image); //current height
  if ((!$w) || (!$h)) {$GLOBALS['errors'][] = 'Image couldn\'t be resized because it wasn\'t a valid image.';return false;}
  if (($w <= $max_width) && ($h <= $max_height)) {return $image;} //no resizing needed
  //try max width first...
  $ratio = $max_width / $w;
  $new_w = $max_width;
  $new_h = $h * $ratio;
  //if that didn't work
  if ($new_h > $max_height) {
    $ratio = $max_height / $h;
    $new_h = $max_height;
    $new_w = $w * $ratio;
  }
  $new_image = imagecreatetruecolor($new_w, $new_h);
  imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h);
  return $new_image;
}
function resize_image_crop($image, $width, $height) {
  $w = @imagesx($image); //current width
  $h = @imagesy($image); //current height
  if ((!$w) || (!$h)) {$GLOBALS['errors'][] = 'Image couldn\'t be resized because it wasn\'t a valid image.';return false;}
  if (($w == $width) && ($h == $height)) {return $image;} //no resizing needed
  //try max width first...
  $ratio = $width / $w;
  $new_w = $width;
  $new_h = $h * $ratio;
  //if that created an image smaller than what we wanted, try the other way
  if ($new_h < $height) {
    $ratio = $height / $h;
    $new_h = $height;
    $new_w = $w * $ratio;
  }
  $image2 = imagecreatetruecolor($new_w, $new_h);
  imagecopyresampled($image2, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h);
  //check to see if cropping needs to happen
  if (($new_h != $height) || ($new_w != $width)) {
    $image3 = imagecreatetruecolor($width, $height);
    if ($new_h > $height) {
      //crop vertically
      $extra = $new_h - $height;
      $x     = 0; //source x
      $y     = round($extra / 2); //source y
      imagecopyresampled($image3, $image2, 0, 0, $x, $y, $width, $height, $width, $height);
    } else {
      $extra = $new_w - $width;
      $x     = round($extra / 2); //source x
      $y     = 0; //source y
      imagecopyresampled($image3, $image2, 0, 0, $x, $y, $width, $height, $width, $height);
    }
    imagedestroy($image2);
    return $image3;
  } else {
    return $image2;
  }
}
function upload_image($file) {
  $targetDir      = wp_upload_dir()["basedir"] . '/image-files/';
  $allowTypes     = array('jpg', 'png', 'jpeg');
  $fileName       = round(microtime(true)) . "_" . basename($file['name']);
  $targetFilePath = $targetDir . $fileName;
  // Check whether file type is valid
  $fileType = pathinfo($targetFilePath, PATHINFO_EXTENSION);
  if (in_array($fileType, $allowTypes)) {
    if ($file["size"] > 10000000) {
      return array("status" => "error", "content" => "Maximum 10Mb");
    }
    if (move_uploaded_file($file['tmp_name'], $targetFilePath)) {
      resize_image('crop', $targetDir . $fileName, $targetDir . '200x200/' . $fileName, 200, 200);
      $file_id = umm_model_insert_img($fileName);
      return array("status" => "success", "content" => $file_id);
    }
  } else {
    return array("status" => "error", "content" => "Allow jpg, png, jpeg");
  }
}
function umm_model_insert_img($file_name) {
  global $wpdb;
  $table  = $wpdb->prefix . 'images';
  $data   = array('image_name' => $file_name, 'user_id' => get_current_user_id());
  $format = array('%s', '%d');
  $wpdb->insert($table, $data, $format);
  return $wpdb->insert_id;
}
function get_image_url_by_id($id, $size = "full") {
  $url = wp_get_upload_dir()["baseurl"] . "/image-files/";
  if ($size != "full") {
    $url = wp_get_upload_dir()["baseurl"] . "/image-files/200x200/";
  }
  global $wpdb;
  $table  = $wpdb->prefix . "images";
  $result = $wpdb->get_results($wpdb->prepare(" SELECT image_name  FROM  {$table} WHERE id = %d ", $id), ARRAY_A, 1);
  return $url . $result[0]["image_name"];
}
/**
 *
 * Delete uploaded images file, database
 */
function delete_img_by_id($img_id) {
  global $wpdb;
  $table     = $wpdb->prefix . "images";
  $result    = $wpdb->get_results($wpdb->prepare(" SELECT image_name  FROM  {$table} WHERE id = %d ", $img_id), ARRAY_A, 1);
  $file_name = $result[0]["image_name"];
  $folder    = wp_upload_dir()["basedir"] . '/image-files/';
  unlink($folder . $file_name);
  unlink($folder . "200x200/" . $file_name);
  $wpdb->delete($table, array('id' => $img_id), array('%d'));
}
/**
 *
 * Get image url avatar  by user id
 */
function get_url_avatar($user_id = '') {
  if ($user_id === '') {
    $user_id = get_current_user_id();
  }
  $id_avatar = get_user_meta($user_id, 'id_img_avatar', true);
  if ($id_avatar) {
    return get_image_url_by_id($id_avatar, 'thumbnail');
  }
  return AVATAR_DF;
}
/**
 *
 * Check user exists
 * @return boolean
 */
function is_user_exist($user_id) {
  $user       = get_userdata($user_id);
  $user_roles = !empty($user) ? $user->roles[0] : "";
  if ($user === false or $user_roles != USER) {
    return false;
  } else {
    return true;
  }
}
/**
 *
 * Check View other account
 * @return boolean
 */
function is_view_other_account() {
  if (is_page('account') && isset($_GET['id']) && intval($_GET['id']) !== get_current_user_id()) {
    return true;
  }
  return false;
}
/**
 *
 * Get list user follow
 * @return array
 */
function list_user_follow($user_id = null) {
  if (!$user_id) {
    $user_id = get_current_user_id();
  }
  $list_user_follow = get_user_meta($user_id, 'list_user_follow', true);
  if (!$list_user_follow) {
    return array();
  }
  return json_decode($list_user_follow, true);
}
/**
 *
 * Nhận danh sách người theo dõi tôi
 * @return array
 */
function get_list_follower($current_user_id = null) {
  if (!$current_user_id) {
    $current_user_id = get_current_user_id();
  }
  $args              = array('role' => USER);
  $users             = get_users($args);
  $list_follower_arr = [];
  foreach ($users as $value) {
    $user_id         = $value->ID;
    $list_follow_arr = list_user_follow($user_id);
    if ($list_follow_arr):
      if (in_array($current_user_id, $list_follow_arr)) {
        $list_follower_arr[] = $user_id;
      }
    endif;
  }
  return $list_follower_arr;
}
/**
 *
 * Nhận tổng số người tôi đang theo dõi
 * @return int
 */
function get_total_following($current_user_id = null) {
  if (!$current_user_id) {
    $current_user_id = get_current_user_id();
  }
  return count(list_user_follow($current_user_id));
}

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\page-account.php

<?php get_header()?>
<?php
  require get_template_directory() . '/framework/frontend.php';
  new BJ_Frontend();
?>
<?php get_footer()?>

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\frontend.php

<?php
class BJ_Frontend {
  private function load() {
    global $bj_controller;
    return $bj_controller;
  }
  function __construct() {
    if (is_page('account')) {
      $this->load()->Controller("Account");
    }
  }
}

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\controllers\Account.php

<?php
class BJ_Account_Controller extends Pv_Controller {
  function __construct() {
    if (isset($_GET['action'])):
      switch ($_GET['action']) {
        case "edit-info":
          $this->update_info();
        break;
      default:
        $this->index();
      } 
    else :
      $this->index();
    endif;
  }
  private function get_user_id() {
    if (isset($_GET["id"]) && is_user_exist(strip_tags($_GET["id"]))) {
      return $_GET["id"];
    } else {
      return get_current_user_id();
    }
  }
  public function index() {
    $data                         = array();
    $user_id                      = $this->get_user_id();
    $user_obj                     = get_userdata($user_id);
    $data['id']                   = $user_id;
    $data['display_name']         = $user_obj->display_name;
    $data['date_registered']      = date_i18n(__('jS F Y', 'umm'), strtotime($user_obj->user_registered));
    $data['avatar']               = get_url_avatar($user_id);
    $data['province_address_arr'] = atw_load_province_address($user_id);
    $this->load()->View("account", $data, "account");
  }
  public function update_info() {
    $data = array();
    $this->load()->View("update-info", $data, "account");
  }
}

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\views\account\update-info.php

<?php
  global $current_user;
  $current_email = $current_user->user_email;
  $current_user_id = $current_user->ID;
  $current_name = $current_user->display_name;
  $phone = get_user_meta( $current_user_id, 'user_phone', true );
  $language = get_user_meta( $current_user_id, 'language', true );
  $url_avatar = get_url_avatar();
  $province_address_arr = get_address_by_id_user();
?>
<div class="page-update-info container">
  <div class="box-update-info mt-4">
    <form id="form-update-info" class="form-update pb-4" action="" method="POST" enctype="multipart/form-data">
      <div class="form-update__avarta w-100 d-flex align-items-center justify-content-center mb-4">
        <div class="position-relative box-preview-img">
          <img id="preview-img" src="<?php echo $url_avatar; ?>" class="rounded-circle" width="94" height="94">
          <div class="btn-upload position-absolute d-flex align-items-center justify-content-center">
            <svg width="18" height="17" viewBox="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">
              <path d="M9.05183 12.0919C10.6882 12.0919 12.0148 10.7654 12.0148 9.12898C12.0148 7.49258 10.6882 6.16602 9.05183 6.16602C7.41543 6.16602 6.08887 7.49258 6.08887 9.12898C6.08887 10.7654 7.41543 12.0919 9.05183 12.0919Z" fill="#515151" />
              <path d="M6.44445 0.299805L4.81778 2.07758H2.00001C1.02223 2.07758 0.222229 2.87758 0.222229 3.85536V14.522C0.222229 15.4998 1.02223 16.2998 2.00001 16.2998H16.2222C17.2 16.2998 18 15.4998 18 14.522V3.85536C18 2.87758 17.2 2.07758 16.2222 2.07758H13.4045L11.7778 0.299805H6.44445ZM9.11112 13.6331C6.65778 13.6331 4.66667 11.642 4.66667 9.18869C4.66667 6.73536 6.65778 4.74425 9.11112 4.74425C11.5645 4.74425 13.5556 6.73536 13.5556 9.18869C13.5556 11.642 11.5645 13.6331 9.11112 13.6331Z" fill="#515151" />
            </svg>
          </div>
          <input type="file" class="hidden" name="image-avarta" id="image-avatar" accept=".jpg,.jpeg,.png">
        </div>
      </div>
      <div class="form-group">
        <label class="form-label">
          <?php _e('Your name *', 'umm'); ?></label>
        <input type="text" name="username" class="form-control username" id="username" value="<?php echo $current_name ?>" placeholder="<?php _e('Username', 'cafe');  ?>" required autocomplete="off">
      </div>
      <div class="form-group">
        <label class="form-label">Email *</label>
        <input type="email" name="email" class="form-control email" id="email" value="<?php echo $current_email ?>" placeholder="Email" aria-describedby="emailHelp" required>
      </div>
      <div class="form-group">
        <label class="form-label">
          <?php _e('Phone', 'umm'); ?></label>
        <input type="tel" name="phone" class="form-control phone" id="phone" value="<?php echo $phone ?>" placeholder="<?php _e('Phone', 'cafe');  ?>">
      </div>
      <div class="form-group">
        <label class="form-label">
          <?php _e('Language', 'umm'); ?></label>
          <input type="text" name="language" class="form-control language" id="language" value="<?php echo $language ?>" placeholder="English, Korean">
      </div>
      <div class="text-address size-18 font-weight-600 my-2">
        <?php _e('Address', 'umm'); ?>
      </div>
      <div class="form-group province">
        <label class="form-label">
          <?php _e('City', 'umm'); ?></label>
        <select class="form-select province-select" name="province" id="province-select">
          <option selected>
            <?php _e('Choose City...', 'umm'); ?>
          </option>
          <?php reder_province_option($province_address_arr['province']); ?>
        </select>
      </div>
      <div class="form-group district">
        <label class="form-label">
          <?php _e('District', 'umm'); ?></label>
        <select class="form-select district-select" name="district" id="district-select">
          <option selected>
            <?php _e('Choose District...', 'umm'); ?>
          </option>
          <?php 
            reder_quan_huyen_option($province_address_arr['province'], $province_address_arr['district']);
          ?>
        </select>
      </div>
      <div class="form-group ward">
        <label class="form-label">
          <?php _e('Ward', 'umm'); ?></label>
        <select class="form-select ward-select" name="ward" id="ward-select">
          <option selected>
            <?php _e('Choose Ward...', 'umm'); ?>
          </option>
          <?php  
            reder_xa_phuong_option($province_address_arr['district'], $province_address_arr['ward']);
          ?>
        </select>
      </div>
      <div class="form-group">
        <label class="form-label">
          <?php _e('Street', 'umm'); ?></label>
        <input type="text" name="street" class="form-control street" id="street" value="<?php echo $province_address_arr['street']; ?>" placeholder="Street">
      </div>
      <div class="notifi__update my-3 alert alert-warning hidden" role="alert">
        <?php _e('Update successful', 'umm');  ?>
      </div>
      <div>
        <?php wp_nonce_field(AT_NONCE_KEY . 'update-info', 'update-info-token'); ?>
      </div>
      <button type="submit" class="btn btn__update w-100 at-rounded-14 bg-primary at-rounded-10 font-weight-500 text-white mt-3"><?php _e("Update", "cafe") ?></button>
    </form>
  </div>
</div>

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\js\custom.js

jQuery(document).ready(function($) {
  function addLoading() {
    $('#page-load').css({ 'opacity': '1', 'visibility': 'visible' });
  }
  function unLoading() {
    $('#page-load').css({ 'opacity': '0', 'visibility': 'hidden' });
  }
  const boxMessage = $('.notifi__update');
  $("body").on("submit", "form#form-update-info", function(e) {
    e.preventDefault();
    var fd = new FormData(document.getElementById("form-update-info"));
    fd.append('action', 'app_update_info');
    $.ajax({
      url: app.ajaxUrl,
      type: "post",
      contentType: false,
      processData: false,
      data: fd,
      beforeSend: function() { 
        addLoading() 
      },
      success: function(output) {
        unLoading();
        var result = $.parseJSON(output);
        if (result.status === false) {
          setTimeout(() => {
            var currURL = window.location.href;
            var urlReload = replaceUrlParam(currURL, 'appt', 'C');
            window.location.replace(urlReload);
          }, 1500)
        } else {
          boxMessage.text(result.message);
        }
        boxMessage.removeClass('hidden');
      },
      error: function(jqXHR, textStatus, errorThrown) {
        unLoading();
        alert('error');
      }
    });
  });
  $("input").blur(function() {
    boxMessage.addClass('hidden');
  })
});

action=edit-info

Not action (Page index)

C:\xampp\htdocs\reset4\wp-content\themes\addframwork\framework\views\account\account.php

<?php 
  $current_user_id = get_current_user_id();
  $total_followers = count(get_list_follower($args['id']));
  $total_following = get_total_following($args['id']);
  $link_followers = SITE_URL . 'account/?action=followers&appt=N';
  $link_following = SITE_URL . 'account/?action=following&appt=N';
  if ( is_view_other_account() ){
    $link_followers = SITE_URL . "account/?id={$args['id']}&action=followers&appt=N";
    $link_following = SITE_URL . "account/?id={$args['id']}&action=following&appt=N";
  }
  $list_news_favorite_arr = json_decode(get_user_meta($current_user_id ,"news_favorite",true),true);
?>
<div class="page-account container">
  <div class="box-avatar d-flex align-items-center justify-content-around my-4">
    <img src="<?php echo $args['avatar'] ?>" class="rounded-circle" width="108" height="108">
    <div class="followers">
      <div class="account-name font-weight-500 size-24">
        <?php echo $args['display_name'];?>
      </div>
      <a href="<?php echo $link_followers ?>"> <span>
          <?php echo $total_followers; ?> </span>
        <?php _e('followers', 'umm'); ?></a>
    </div>
    <div class="following">
      <a href="<?php echo $link_following ?>"> <span>
          <?php echo $total_following; ?> </span>
        <?php _e('following', 'umm'); ?></a>
    </div>
  </div>
  <div class="account-info">
    <div class="account-info__highlight d-flex align-items-center justify-content-between border-b-1 pb-2">
      <div class="font-weight-600 size-18">
        <?php _e('Highlights', 'umm'); ?>
      </div>
      <?php if( !is_view_other_account() ): ?>
      <a href="<?php echo SITE_URL ?>account/?action=edit-info&appt=N" class="btn d-flex align-items-center justify-content-center">
        <svg width="16" height="16">
          <use href="#icon-pen-edit"></use>
        </svg>
      </a>
      <?php else: ?>
      <?php if(  !in_array( $args['id'], list_user_follow() ) ): ?>
      <button type="button" data-id="<?php echo $args['id'] ?>" class="btn btn-follow__add bg-primary text-white font-weight-600">
        <?php _e('Follow', 'umm'); ?>
      </button>
      <?php else: ?>
      <button type="button" data-id="<?php echo $args['id'] ?>" class="btn btn-follow__remove bg-primary text-white font-weight-600">
        <?php _e('Unfollow', 'umm'); ?>
      </button>
      <?php endif; ?>
      <?php endif; ?>
    </div>
    <div class="account-info__general ml-2">
      <div class="account-info__general__item mt-3 d-flex align-items-center address">
        <div class="icon d-flex align-items-center justify-content-center">
          <svg width="18" height="21">
            <use href="#icon-adress"></use>
          </svg>
        </div>
        <div class="ml-2">
          <?php echo sprintf( __("Live in %s","umm"),$args['province_address_arr']['province'] ); ?>
        </div>
      </div>
      <div class="account-info__general__item mt-3 d-flex align-items-center joined">
        <div class="icon d-flex align-items-center justify-content-center">
          <svg width="18" height="18">
            <use href="#icon-time"></use>
          </svg>
        </div>
        <div class="ml-2">
          <?php echo sprintf( __("Joined %s","umm"),$args['date_registered'] ); ?>
        </div>
      </div>
      <div class="account-info__general__item mt-3 d-flex align-items-center language">
        <div class="icon d-flex align-items-center justify-content-center">
          <svg width="22" height="23">
            <use href="#icon-language"></use>
          </svg>
        </div>
        <div class="ml-2">
          English, Korean
        </div>
      </div>
      <?php if ( !is_view_other_account() ): ?>
      <button type="button" data-type="activity" data-id="<?php echo $args['id'] ?>" id="change-acc" class="w-100 btn bg-primary at-rounded-14 text-white mt-3">
        <span>
          <?php _e("Activity","umm") ?> </span>
        <svg width="18" height="14" viewBox="0 0 18 14" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M14.7273 3.5L11.4545 7H13.9091C13.9091 9.89625 11.7082 12.25 9 12.25C8.17364 12.25 7.38818 12.0312 6.70909 11.6375L5.51455 12.915C6.52091 13.5975 7.71545 14 9 14C12.6164 14 15.5455 10.8675 15.5455 7H18L14.7273 3.5ZM4.09091 7C4.09091 4.10375 6.29182 1.75 9 1.75C9.82636 1.75 10.6118 1.96875 11.2909 2.3625L12.4855 1.085C11.4791 0.4025 10.2845 0 9 0C5.38364 0 2.45455 3.1325 2.45455 7H0L3.27273 10.5L6.54545 7H4.09091Z" fill="white" />
        </svg>
      </button>
      <button style="display:none" type="button" data-id="<?php echo $args['id'] ?>" id="scan-voucher" class="scan-voucher w-100 btn at-rounded-14 text-white mt-3 position-relative">
        <span class="mr-1">
          <?php _e("Scan voucher","umm") ?> </span>
        <svg width="15" height="16" viewBox="0 0 15 16" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M0 15.1314H6.81811V8.25342H0V15.1314ZM1.36352 9.62912H5.45444V13.7452H1.36352V9.62912Z" fill="white" />
          <path d="M4.09064 11.0049H2.72705V12.3806H4.09064V11.0049Z" fill="white" />
          <path d="M12.2726 13.7559H10.9087V15.1314H12.2726V13.7559Z" fill="white" />
          <path d="M14.9996 13.7559H13.6357V15.1314H14.9996V13.7559Z" fill="white" />
          <path d="M13.6362 9.62912H12.2727V8.25342H8.18164V15.1314H9.54538V11.0046H10.9088V12.3803H14.9998V8.25342H13.6362V9.62912Z" fill="white" />
          <path d="M0 6.87806H6.81811V0H0V6.87806ZM1.36352 1.37548H5.45444V5.50229H1.36352V1.37548Z" fill="white" />
          <path d="M4.09064 2.75098H2.72705V4.12664H4.09064V2.75098Z" fill="white" />
          <path d="M8.18164 0V6.87806H14.9999V0H8.18164ZM13.6362 5.50229H9.54538V1.37548H13.6362V5.50229Z" fill="white" />
          <path d="M12.2726 2.75098H10.9087V4.12664H12.2726V2.75098Z" fill="white" />
        </svg>
      </button>
      <?php else: ?>
      <div style="margin-left:-0.25rem;margin-bottom:-1rem;" class="font-weight-600 size-18 mt-3">
        <?php _e('Activity ', 'umm'); ?>
      </div>
      <?php endif; ?>
    </div>
    <nav class="menu-tab menu-tab-account mt-4">
      <ul class="d-flex align-items-center justify-content-around text-center p-0">
        <li class="flex-fill active li"><a href="javascript:void(0)" class="account-load-btn tab-a" data-id="deal"> <span>_</span>
            <?php _e('Deal', 'umm'); ?> </a></li>
        <li class="flex-fill li"><a href="javascript:void(0)" class="load account-load-btn tab-a" data-id="event"><span>_</span>
            <?php _e('Events', 'umm'); ?></a></li>
        <li class="flex-fill li"><a href="javascript:void(0)" class="load account-load-btn tab-a" data-id="market"><span>_</span>
            <?php _e('Market', 'umm'); ?></a></li>
        <li class="flex-fill li account-load-list-business-btn"><a href="javascript:void(0)" class="tab-a" data-id="business"><span>_</span>
            <?php _e('Business', 'umm'); ?></a></li>
        <li class="flex-fill"><a href="javascript:void(0)" class="tab-a" data-id="news"><span>
              <?php echo !empty($list_news_favorite_arr) ? count($list_news_favorite_arr) : 0 ?></span>
            <?php _e('News', 'umm'); ?></a></li>
      </ul>
    </nav>
    <div class="tab tab-active tab-deal" data-tab-id="deal">
      <div class="container">
        <div class="row account-list-item">
          <div class="col-6 col-addnew d-none">
            <div class="box add-new">
              <a href="?action=add-deal&appt=N">
                <svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <path d="M27 52C40.8071 52 52 40.8071 52 27C52 13.1929 40.8071 2 27 2C13.1929 2 2 13.1929 2 27C2 40.8071 13.1929 52 27 52Z" stroke="#515151" stroke-width="4" />
                  <path d="M27.0003 18.0713V27.8927M27.0003 27.8927V37.7141M27.0003 27.8927H35.9289M27.0003 27.8927H18.0718" stroke="#515151" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
                </svg>
                <p class="mb-0">
                  <?php _e("Add Listing","umm") ?>
                </p>
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="tab tab-event" data-tab-id="event">
      <div class="container">
        <div class="row account-list-item list-item">
          <div class="col-6 col-addnew d-none">
            <div class="box add-new">
              <a href="?action=add-event&appt=N">
                <svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <path d="M27 52C40.8071 52 52 40.8071 52 27C52 13.1929 40.8071 2 27 2C13.1929 2 2 13.1929 2 27C2 40.8071 13.1929 52 27 52Z" stroke="#515151" stroke-width="4" />
                  <path d="M27.0003 18.0713V27.8927M27.0003 27.8927V37.7141M27.0003 27.8927H35.9289M27.0003 27.8927H18.0718" stroke="#515151" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
                </svg>
                <p class="mb-0">
                  <?php _e("Add Listing","umm") ?>
                </p>
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="tab tab-market" data-tab-id="market">
      <div class="container">
        <div class="row account-list-item">
          <div class="col-6 col-addnew d-none">
            <div class="box add-new">
              <a href="?action=add-market&appt=N">
                <svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <path d="M27 52C40.8071 52 52 40.8071 52 27C52 13.1929 40.8071 2 27 2C13.1929 2 2 13.1929 2 27C2 40.8071 13.1929 52 27 52Z" stroke="#515151" stroke-width="4" />
                  <path d="M27.0003 18.0713V27.8927M27.0003 27.8927V37.7141M27.0003 27.8927H35.9289M27.0003 27.8927H18.0718" stroke="#515151" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
                </svg>
                <p class="mb-0">
                  <?php _e("Add Listing","umm") ?>
                </p>
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="tab tab-business" data-tab-id="business">
      <div class="container">
        <div class="row account-list-item">
          <div class="col-6 col-addnew d-none">
            <div class="box add-new">
              <a href="javascript:void(0)" data-bs-toggle="modal" data-bs-target=".step-1.add-business">
                <svg width="54" height="54" viewBox="0 0 54 54" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <path d="M27 52C40.8071 52 52 40.8071 52 27C52 13.1929 40.8071 2 27 2C13.1929 2 2 13.1929 2 27C2 40.8071 13.1929 52 27 52Z" stroke="#515151" stroke-width="4" />
                  <path d="M27.0003 18.0713V27.8927M27.0003 27.8927V37.7141M27.0003 27.8927H35.9289M27.0003 27.8927H18.0718" stroke="#515151" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
                </svg>
                <p class="mb-0">
                  <?php _e("Add Listing","umm") ?>
                </p>
              </a>
            </div>
          </div>
        </div>
        <div class="text-center status d-none">
          <img src="<?php echo THEME_URL ?>assets/images/loading.gif" alt="loader" style="height: 30px;display: inline-block;margin-bottom: 50px;">
        </div>
      </div>
    </div>
    <div class="tab tab-news" data-tab-id="news">
      <div class="row">
        <?php  
          if(!empty($list_news_favorite_arr)){ 
            $args = array(
              'post_type' => "post",  
              'post__in' => $list_news_favorite_arr,
            );
            $the_query = new WP_Query( $args );
            if ( $the_query->have_posts() ) {
              while ( $the_query->have_posts() ) { $the_query->the_post();
        ?>
        <div class="col-6 ">
          <a href="<?php echo $link = get_the_permalink()." ?appt=N"; ?>">
            <?php the_post_thumbnail("thumbnail") ?></a>
          <div class="bottom">
            <a class="title" href="<?php echo $link ?>">
              <?php the_title() ?></a>
            <div class="text-right">
              <button class="news add-favorite added" data-id="<?php the_ID() ?>">
                <svg width="15" height="27" viewBox="0 0 20 27" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <path d="M19 26L10 19.0556L1 26V3.77778C1 3.04107 1.27092 2.33453 1.75315 1.81359C2.23539 1.29266 2.88944 1 3.57143 1H16.4286C17.1106 1 17.7646 1.29266 18.2468 1.81359C18.7291 2.33453 19 3.04107 19 3.77778V26Z" fill="#686868" stroke="#686868" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
                </svg>
              </button>
            </div>
          </div>
        </div>
        <?php
              }
            };
            wp_reset_postdata();
          }else{
            _e("No data");
          }
        ?>
      </div>
    </div>
    <div class="text-center status d-none">
      <img src="<?php echo THEME_URL ?>assets/images/loading.gif" alt="loader" style="height: 30px;display: inline-block;margin-bottom: 50px;">
    </div>
  </div>
</div>

Last updated