|
@@ -260,6 +260,28 @@ function uiu_acf_update_user_id($value, $post_id, $field)
|
|
|
add_filter('acf/update_value/name=employeeid', 'uiu_acf_update_user_id', 10, 3);
|
|
|
|
|
|
|
|
|
+/**
|
|
|
+ * Make theme option page field value available via REST API
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+function theme_options_route_menu()
|
|
|
+{
|
|
|
+ return get_field('menu_rich_contents', 'option');
|
|
|
+}
|
|
|
+
|
|
|
+add_action("rest_api_init", function () {
|
|
|
+ register_rest_route("options", "/menu", [
|
|
|
+ "methods" => "GET",
|
|
|
+ "callback" => "theme_options_route_menu",
|
|
|
+ ]);
|
|
|
+});
|
|
|
+
|
|
|
+add_action('rest_api_init', function () {
|
|
|
+ header("Access-Control-Allow-Origin: *");
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* Custom Walker class to add extra element to sub-menu ul.
|
|
|
*/
|
|
@@ -272,7 +294,7 @@ class Custom_Walker_Nav_Menu extends Walker_Nav_Menu
|
|
|
|
|
|
|
|
|
parent::start_lvl($output, $depth, $args);
|
|
|
- $output .= '<div class="container"><div class="extra-item col-breaker">
|
|
|
+ $output .= '<div class="container"><div class="sub-menu-feature">
|
|
|
<img class="menu_feature_image" src="../wp-content/themes/uiu-cse/img/menu-background.jpg" alt="">
|
|
|
<div class="heading-text menu_title">
|
|
|
Research
|
|
@@ -280,13 +302,13 @@ class Custom_Walker_Nav_Menu extends Walker_Nav_Menu
|
|
|
<div class="text menu_description">
|
|
|
We collect personal information from you so we can provide investment services to you.
|
|
|
</div>
|
|
|
- </div>';
|
|
|
+ </div><div class="sub-menu-link-container">';
|
|
|
}
|
|
|
|
|
|
public function end_lvl(&$output, $depth = 0, $args = array())
|
|
|
{
|
|
|
// Add your extra element here.
|
|
|
- $output .= '</div>';
|
|
|
+ $output .= '</div></div>';
|
|
|
parent::end_lvl($output, $depth, $args);
|
|
|
}
|
|
|
}
|
|
@@ -303,51 +325,29 @@ add_filter('wp_nav_menu_args', 'custom_menu_walker');
|
|
|
* Insert_extra_element_to_submenu
|
|
|
*/
|
|
|
|
|
|
-function insert_extra_element_to_submenu($matches)
|
|
|
-{
|
|
|
- $sub_menu_ul = $matches[0];
|
|
|
- $extra_element = '<div class="extra-item col-breaker">
|
|
|
- <img class="menu_feature_image" src="../wp-content/themes/uiu-cse/img/menu-background.jpg" alt="">
|
|
|
- <div class="heading-text menu_title">
|
|
|
- Research
|
|
|
- </div>
|
|
|
- <div class="text menu_description">
|
|
|
- We collect personal information from you so we can provide investment services to you.
|
|
|
- </div>
|
|
|
- </div>';
|
|
|
- $sub_menu_ul .= $extra_element;
|
|
|
- return $sub_menu_ul;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function custom_add_extra_element_to_submenu($nav_menu, $args)
|
|
|
-{
|
|
|
- // Find all sub-menu ul elements and add the extra element after each one.
|
|
|
- $nav_menu = preg_replace_callback('/(<ul\s*class="sub-menu[^"]*">)/', 'insert_extra_element_to_submenu', $nav_menu);
|
|
|
-
|
|
|
- return $nav_menu;
|
|
|
-}
|
|
|
-
|
|
|
-// add_filter('wp_nav_menu', 'custom_add_extra_element_to_submenu', 10, 2);
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- * Make theme option page field value available via REST API
|
|
|
- */
|
|
|
-
|
|
|
-
|
|
|
-function theme_options_route_menu()
|
|
|
-{
|
|
|
- return get_field('menu_rich_contents', 'option');
|
|
|
-}
|
|
|
-
|
|
|
-add_action("rest_api_init", function () {
|
|
|
- register_rest_route("options", "/menu", [
|
|
|
- "methods" => "GET",
|
|
|
- "callback" => "theme_options_route_menu",
|
|
|
- ]);
|
|
|
-});
|
|
|
-
|
|
|
-add_action('rest_api_init', function () {
|
|
|
- header("Access-Control-Allow-Origin: *");
|
|
|
-});
|
|
|
+// function insert_extra_element_to_submenu($matches)
|
|
|
+// {
|
|
|
+// $sub_menu_ul = $matches[0];
|
|
|
+// $extra_element = '<div class="extra-item col-breaker">
|
|
|
+// <img class="menu_feature_image" src="../wp-content/themes/uiu-cse/img/menu-background.jpg" alt="">
|
|
|
+// <div class="heading-text menu_title">
|
|
|
+// Research
|
|
|
+// </div>
|
|
|
+// <div class="text menu_description">
|
|
|
+// We collect personal information from you so we can provide investment services to you.
|
|
|
+// </div>
|
|
|
+// </div>';
|
|
|
+// $sub_menu_ul .= $extra_element;
|
|
|
+// return $sub_menu_ul;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// function custom_add_extra_element_to_submenu($nav_menu, $args)
|
|
|
+// {
|
|
|
+// // Find all sub-menu ul elements and add the extra element after each one.
|
|
|
+// $nav_menu = preg_replace_callback('/(<ul\s*class="sub-menu[^"]*">)/', 'insert_extra_element_to_submenu', $nav_menu);
|
|
|
+
|
|
|
+// return $nav_menu;
|
|
|
+// }
|
|
|
+
|
|
|
+// add_filter('wp_nav_menu', 'custom_add_extra_element_to_submenu', 10, 2);
|