| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
die('-1'); |
| 5 |
} |
| 6 |
|
| 7 |
class QuadMenu_Divi_Module { |
| 8 |
|
| 9 |
public function __construct() { |
| 10 |
add_action('et_builder_ready', array($this, 'module')); |
| 11 |
|
| 12 |
add_action('et_builder_ready', array($this, 'cache')); |
| 13 |
|
| 14 |
add_action('quadmenu_create_theme', array($this, 'clear_builder_cache')); |
| 15 |
|
| 16 |
add_action('quadmenu_delete_theme', array($this, 'clear_builder_cache')); |
| 17 |
|
| 18 |
add_filter('wp_nav_menu_args', array($this, 'fullwidth_menu'), 100000, 1); |
| 19 |
} |
| 20 |
|
| 21 |
function fullwidth_menu($args) { |
| 22 |
|
| 23 |
if (class_exists('ET_Builder_Module')) { |
| 24 |
if (isset($args['menu_class']) && strpos($args['menu_class'], 'fullwidth-menu') !== false) { |
| 25 |
$args['theme_location'] = false; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
return $args; |
| 30 |
} |
| 31 |
|
| 32 |
function cache() { |
| 33 |
|
| 34 |
if (get_transient('quadmenu_create_theme')) { |
| 35 |
|
| 36 |
et_update_option('et_pb_clear_templates_cache', true); |
| 37 |
|
| 38 |
delete_transient('quadmenu_create_theme'); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
function module() { |
| 43 |
require_once 'divi/module.php'; |
| 44 |
} |
| 45 |
|
| 46 |
function clear_builder_cache() { |
| 47 |
set_transient('quadmenu_create_theme', true, 30); |
| 48 |
} |
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
new QuadMenu_Divi_Module(); |
| 53 |
|