| 1 |
;(function () { |
| 2 |
/** |
| 3 |
* Run function when customizer is ready. |
| 4 |
*/ |
| 5 |
wp.customize.bind('ready', function () { |
| 6 |
|
| 7 |
var condition, |
| 8 |
archives_condition, |
| 9 |
singular_condition, |
| 10 |
woocommerce_condition, |
| 11 |
singular_page_condition, |
| 12 |
singular_post_condition, |
| 13 |
singular_product_condition; |
| 14 |
|
| 15 |
|
| 16 |
wp.customize.control('wpbottommenu_condition', function (control) { |
| 17 |
|
| 18 |
const toggleControl = (value) => { |
| 19 |
condition = value; |
| 20 |
wp.customize.control('wpbottommenu_archives_condition').toggle(false); |
| 21 |
wp.customize.control('wpbottommenu_woocommerce_condition').toggle(false); |
| 22 |
wp.customize.control('wpbottommenu_singular_condition').toggle(false); |
| 23 |
//wp.customize.control('wpbottommenu_singular_page_condition').toggle(false); |
| 24 |
|
| 25 |
switch (value){ |
| 26 |
case 'archives': |
| 27 |
wp.customize.control('wpbottommenu_archives_condition').toggle(true); |
| 28 |
wp.customize.control('wpbottommenu_singular_page_condition').toggle(false); |
| 29 |
wp.customize.control('wpbottommenu_singular_post_condition').toggle(false); |
| 30 |
//wp.customize.control('wpbottommenu_singular_product_condition').toggle(false); |
| 31 |
break; |
| 32 |
case 'woocommerce': |
| 33 |
wp.customize.control('wpbottommenu_woocommerce_condition').toggle(true); |
| 34 |
wp.customize.control('wpbottommenu_singular_page_condition').toggle(false); |
| 35 |
wp.customize.control('wpbottommenu_singular_post_condition').toggle(false); |
| 36 |
break; |
| 37 |
case 'singular': |
| 38 |
wp.customize.control('wpbottommenu_singular_condition').toggle(true); |
| 39 |
wp.customize.control('wpbottommenu_singular_product_condition').toggle(false); |
| 40 |
break; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
}; |
| 45 |
|
| 46 |
toggleControl(control.setting.get()); |
| 47 |
control.setting.bind(toggleControl); |
| 48 |
}); |
| 49 |
|
| 50 |
wp.customize.control('wpbottommenu_singular_condition', function (control) { |
| 51 |
|
| 52 |
const toggleControl = (value) => { |
| 53 |
singular_condition = value; |
| 54 |
wp.customize.control('wpbottommenu_singular_page_condition').toggle(false); |
| 55 |
wp.customize.control('wpbottommenu_singular_post_condition').toggle(false); |
| 56 |
|
| 57 |
switch (value){ |
| 58 |
case 'pages': |
| 59 |
wp.customize.control('wpbottommenu_singular_page_condition').toggle(true); |
| 60 |
break; |
| 61 |
case 'post': |
| 62 |
wp.customize.control('wpbottommenu_singular_post_condition').toggle(true); |
| 63 |
break; |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
}; |
| 68 |
|
| 69 |
toggleControl(control.setting.get()); |
| 70 |
control.setting.bind(toggleControl); |
| 71 |
}); |
| 72 |
|
| 73 |
wp.customize.control('wpbottommenu_woocommerce_condition', function (control) { |
| 74 |
|
| 75 |
const toggleControl = (value) => { |
| 76 |
woocommerce_condition = value; |
| 77 |
wp.customize.control('wpbottommenu_singular_product_condition').toggle(false); |
| 78 |
wp.customize.control('wpbottommenu_singular_page_condition').toggle(false); |
| 79 |
wp.customize.control('wpbottommenu_singular_post_condition').toggle(false); |
| 80 |
|
| 81 |
switch (value){ |
| 82 |
case 'product': |
| 83 |
wp.customize.control('wpbottommenu_singular_product_condition').toggle(true); |
| 84 |
break; |
| 85 |
} |
| 86 |
|
| 87 |
}; |
| 88 |
|
| 89 |
toggleControl(control.setting.get()); |
| 90 |
control.setting.bind(toggleControl); |
| 91 |
}); |
| 92 |
|
| 93 |
}); |
| 94 |
})(); |