|
@@ -171,9 +171,9 @@ function uiu_cse_header_menu()
|
|
{
|
|
{
|
|
register_nav_menus(
|
|
register_nav_menus(
|
|
array(
|
|
array(
|
|
- 'uiu-header-menu' => __('UIU Header'),
|
|
|
|
- 'cse-header-menu' => __('CSE Header Menu'),
|
|
|
|
- 'uiu-footer-menu' => __('UIU Footer Menu')
|
|
|
|
|
|
+ 'uiu-global-header-menu' => __('UIU Global Header Menu'),
|
|
|
|
+ 'uiu-departmental-header-menu' => __('UIU Departmental Header Menu'),
|
|
|
|
+ 'uiu-global-footer-menu' => __('UIU Global Footer Menu')
|
|
)
|
|
)
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -260,78 +260,92 @@ function uiu_acf_update_user_id($value, $post_id, $field)
|
|
add_filter('acf/update_value/name=employeeid', 'uiu_acf_update_user_id', 10, 3);
|
|
add_filter('acf/update_value/name=employeeid', 'uiu_acf_update_user_id', 10, 3);
|
|
|
|
|
|
|
|
|
|
|
|
+// function fetch_conference_data($params)
|
|
|
|
+// {
|
|
|
|
+// $auth_token = get_field('auth_token', 'option');
|
|
|
|
+// $client_id = get_field('client_id', 'option');
|
|
|
|
+// $conference_api = get_field('conference_api', 'option');
|
|
|
|
+
|
|
|
|
+// $curl = curl_init();
|
|
|
|
+
|
|
|
|
+// curl_setopt_array($curl, array(
|
|
|
|
+// CURLOPT_URL => $conference_api,
|
|
|
|
+// CURLOPT_RETURNTRANSFER => true,
|
|
|
|
+// CURLOPT_ENCODING => '',
|
|
|
|
+// CURLOPT_MAXREDIRS => 10,
|
|
|
|
+// CURLOPT_TIMEOUT => 0,
|
|
|
|
+// CURLOPT_FOLLOWLOCATION => true,
|
|
|
|
+// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
|
+// CURLOPT_CUSTOMREQUEST => 'POST',
|
|
|
|
+// CURLOPT_POSTFIELDS => '{
|
|
|
|
+// "auth_token" : "' . $auth_token . '",
|
|
|
|
+// "user_login_id" : "' . $client_id . '",
|
|
|
|
+
|
|
|
|
+// "employee_id" : ' . isset($params["author"]) ? " " : " " . ',
|
|
|
|
+// "fromYear" : ' . $params["fromYear"] ?? " " . ',
|
|
|
|
+// "toYear" : ' . $params["toYear"] . ',
|
|
|
|
+// "page" : ' . $params["page"] . ',
|
|
|
|
+// "limit" : ' . $params["limit"] . '
|
|
|
|
+// }',
|
|
|
|
+// CURLOPT_HTTPHEADER => array(
|
|
|
|
+// 'Content-Type: application/json'
|
|
|
|
+// ),
|
|
|
|
+// ));
|
|
|
|
+
|
|
|
|
+// $response = curl_exec($curl);
|
|
|
|
+// curl_close($curl);
|
|
|
|
+// $response = json_decode($response, true);
|
|
|
|
+
|
|
|
|
+// return $response;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// function uiu_conference_route_menu_with_params(WP_REST_Request $request)
|
|
|
|
+// {
|
|
|
|
+// // $arg = $request->get_param('limit');
|
|
|
|
+// $params = $request->get_params();
|
|
|
|
+// // var_dump($params);
|
|
|
|
+
|
|
|
|
+// return fetch_conference_data($params);
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// add_action("rest_api_init", function () {
|
|
|
|
+// register_rest_route("uiu_api", "/conference", [
|
|
|
|
+// "methods" => "GET",
|
|
|
|
+// "callback" => "uiu_conference_route_menu_with_params",
|
|
|
|
+// ]);
|
|
|
|
+// });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Make theme option page field value available via REST API
|
|
* Make theme option page field value available via REST API
|
|
*/
|
|
*/
|
|
-function theme_options_route_menu()
|
|
|
|
|
|
+function theme_options_route_menu_global_header()
|
|
{
|
|
{
|
|
- return get_field('menu_rich_contents', 'option');
|
|
|
|
|
|
+ return get_field('global_menu_rich_contents', 'option');
|
|
}
|
|
}
|
|
-
|
|
|
|
add_action("rest_api_init", function () {
|
|
add_action("rest_api_init", function () {
|
|
- register_rest_route("options", "/menu", [
|
|
|
|
|
|
+ register_rest_route("options/menu", "/global-header", [
|
|
"methods" => "GET",
|
|
"methods" => "GET",
|
|
- "callback" => "theme_options_route_menu",
|
|
|
|
|
|
+ "callback" => "theme_options_route_menu_global_header",
|
|
]);
|
|
]);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
-function fetch_conference_data($limit)
|
|
|
|
-{
|
|
|
|
- $auth_token = get_field('auth_token', 'option');
|
|
|
|
- $client_id = get_field('client_id', 'option');
|
|
|
|
- $conference_api = get_field('conference_api', 'option');
|
|
|
|
-
|
|
|
|
- $curl = curl_init();
|
|
|
|
-
|
|
|
|
- curl_setopt_array($curl, array(
|
|
|
|
- CURLOPT_URL => $conference_api,
|
|
|
|
- CURLOPT_RETURNTRANSFER => true,
|
|
|
|
- CURLOPT_ENCODING => '',
|
|
|
|
- CURLOPT_MAXREDIRS => 10,
|
|
|
|
- CURLOPT_TIMEOUT => 0,
|
|
|
|
- CURLOPT_FOLLOWLOCATION => true,
|
|
|
|
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
|
- CURLOPT_CUSTOMREQUEST => 'POST',
|
|
|
|
- CURLOPT_POSTFIELDS => '{
|
|
|
|
- "employee_id" : " ",
|
|
|
|
- "year" : " ",
|
|
|
|
- "auth_token" : "' . $auth_token . '",
|
|
|
|
- "user_login_id" : "' . $client_id . '",
|
|
|
|
- "page" : 1,
|
|
|
|
- "limit" : ' . $limit . '
|
|
|
|
- }',
|
|
|
|
- CURLOPT_HTTPHEADER => array(
|
|
|
|
- 'Content-Type: application/json'
|
|
|
|
- ),
|
|
|
|
- ));
|
|
|
|
-
|
|
|
|
- $response = curl_exec($curl);
|
|
|
|
- curl_close($curl);
|
|
|
|
- $response = json_decode($response, true);
|
|
|
|
-
|
|
|
|
- return $response;
|
|
|
|
-}
|
|
|
|
|
|
|
|
-function uiu_conference_route_menu_with_params(WP_REST_Request $request)
|
|
|
|
|
|
+function theme_options_route_menu_departmental_header()
|
|
{
|
|
{
|
|
- $arg = $request->get_param('limit');
|
|
|
|
- // $params = $request->get_params();
|
|
|
|
- // var_dump( $arg );
|
|
|
|
-
|
|
|
|
- return fetch_conference_data($arg);
|
|
|
|
|
|
+ return get_field('departmental_menu_rich_contents', 'option');
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
add_action("rest_api_init", function () {
|
|
add_action("rest_api_init", function () {
|
|
- register_rest_route("uiu_api", "/conference", [
|
|
|
|
|
|
+ register_rest_route("options/menu", "/departmental-header", [
|
|
"methods" => "GET",
|
|
"methods" => "GET",
|
|
- "callback" => "uiu_conference_route_menu_with_params",
|
|
|
|
|
|
+ "callback" => "theme_options_route_menu_departmental_header",
|
|
]);
|
|
]);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
add_action('rest_api_init', function () {
|
|
add_action('rest_api_init', function () {
|
|
header("Access-Control-Allow-Origin: *");
|
|
header("Access-Control-Allow-Origin: *");
|
|
});
|
|
});
|