2eb53152 by Jeff Balicki

front page

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent fc66b1d8
Showing 114 changed files with 3099 additions and 156 deletions
1 <?php
2 /**
3 * Credit to PolyLang (https://polylang.pro)
4 * https://plugins.trac.wordpress.org/browser/polylang/trunk/admin/admin-notices.php
5 */
6
7 /**
8 * A class to manage admin notices
9 * displayed only to admin, based on 'manage_options' capability
10 * and only on dashboard, plugins and Max Mega Menu admin pages
11 *
12 */
13 class Mega_Menu_Admin_Notices {
14 /**
15 * Stores the plugin options.
16 *
17 * @var array
18 */
19 protected $options;
20
21 /**
22 * Stores custom notices.
23 *
24 * @var string[]
25 */
26 private static $notices = array();
27
28 /**
29 * Constructor
30 * Setup actions
31 *
32 * @since 3.0
33 *
34 * @param object $polylang
35 */
36 public function __construct() {
37 add_action( 'admin_init', array( $this, 'hide_notice' ) );
38 add_action( 'admin_notices', array( $this, 'display_notices' ) );
39 }
40
41 /**
42 * Add a custom notice
43 *
44 * @since 3.0
45 *
46 * @param string $name Notice name
47 * @param string $html Content of the notice
48 * @return void
49 */
50 public static function add_notice( $name, $html ) {
51 self::$notices[ $name ] = $html;
52 }
53
54 /**
55 * Get custom notices
56 *
57 * @since 3.0
58 *
59 * @return string[]
60 */
61 public static function get_notices() {
62 return self::$notices;
63 }
64
65 /**
66 * Has a notice been dismissed?
67 *
68 * @since 3.0
69 *
70 * @param string $notice Notice name
71 * @return bool
72 */
73 public static function is_dismissed( $notice ) {
74 $dismissed = get_option( 'megamenu_dismissed_notices', array() );
75
76 return in_array( $notice, $dismissed );
77 }
78
79 /**
80 * Should we display notices on this screen?
81 *
82 * @since 3.0
83 *
84 * @param string $notice The notice name.
85 * @return bool
86 */
87 protected function can_display_notice( $notice ) {
88 $screen = get_current_screen();
89
90 if ( empty( $screen ) ) {
91 return false;
92 }
93
94 /**
95 * Filter admin notices which can be displayed
96 *
97 * @since 2.7.0
98 *
99 * @param bool $display Whether the notice should be displayed or not.
100 * @param string $notice The notice name.
101 */
102 return apply_filters(
103 'mmm_can_display_notice',
104 in_array(
105 $screen->id,
106 array(
107 'dashboard',
108 'plugins',
109 'toplevel_page_maxmegamenu'
110 )
111 ),
112 $notice
113 );
114 }
115
116 /**
117 * Stores a dismissed notice in database
118 *
119 * @since 3.0
120 *
121 * @param string $notice
122 * @return void
123 */
124 public static function dismiss( $notice ) {
125 $dismissed = get_option( 'megamenu_dismissed_notices', array() );
126
127 if ( ! in_array( $notice, $dismissed ) ) {
128 $dismissed[] = $notice;
129 update_option( 'megamenu_dismissed_notices', array_unique( $dismissed ) );
130 }
131 }
132
133 /**
134 * Handle a click on the dismiss button
135 *
136 * @since 3.0
137 *
138 * @return void
139 */
140 public function hide_notice() {
141 if ( isset( $_GET['mmm-hide-notice'], $_GET['_mmm_notice_nonce'] ) ) {
142 $notice = sanitize_key( $_GET['mmm-hide-notice'] );
143 check_admin_referer( $notice, '_mmm_notice_nonce' );
144 self::dismiss( $notice );
145 wp_safe_redirect( remove_query_arg( array( 'mmm-hide-notice', '_mmm_notice_nonce' ), wp_get_referer() ) );
146 exit;
147 }
148 }
149
150 /**
151 * Displays notices
152 *
153 * @since 2.3.9
154 *
155 * @return void
156 */
157 public function display_notices() {
158
159 if ( ! $this->can_display_notice( 'review' ) ) {
160 return;
161 }
162
163 if ( defined( 'MEGAMENU_PRO_VERSION' ) ) {
164 return;
165 }
166
167 if ( $this->is_dismissed( 'review' ) ) {
168 return;
169 }
170
171 if ( ! current_user_can( 'manage_options' ) ) {
172 return;
173 }
174
175 $install_date = get_option( 'megamenu_install_date' );
176
177 if ( ! $install_date ) {
178 return;
179 }
180
181 if ( time() > $install_date + ( 14 * DAY_IN_SECONDS ) ) {
182 $this->review_notice();
183 }
184 }
185
186 /**
187 * Displays a dismiss button
188 *
189 * @since 3.0
190 *
191 * @param string $name Notice name
192 * @return void
193 */
194 public function dismiss_button( $name ) {
195 printf(
196 '<a style="text-decoration: none;" class="notice-dismiss" href="%s"><span class="screen-reader-text">%s</span></a>',
197 esc_url( wp_nonce_url( add_query_arg( 'mmm-hide-notice', $name ), $name, '_mmm_notice_nonce' ) ),
198 /* translators: accessibility text */
199 esc_html__( 'Dismiss this notice.', 'megamenu' )
200 );
201 }
202
203 /**
204 * Displays a notice asking for a review
205 *
206 * @since 3.0
207 *
208 * @return void
209 */
210 private function review_notice() {
211 ?>
212 <div class="mmm-notice notice notice-info" style="position: relative; margin-left: 0;">
213 <?php $this->dismiss_button( 'review' ); ?>
214 <p>
215 <?php
216 printf(
217 /* translators: %1$s is link start tag, %2$s is link end tag. */
218 esc_html__( 'We have noticed that you have been using Max Mega Menu for some time. We hope you love it, and we would really appreciate it if you would %1$sgive us a 5 stars rating%2$s.', 'megamenu' ),
219 '<a href="https://wordpress.org/support/plugin/megamenu/reviews/?rate=5#new-post">',
220 '</a>'
221 );
222 ?>
223 </p>
224 </div>
225 <?php
226 }
227 }
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access.
5 }
6
7 if ( ! class_exists( 'Mega_Menu_General' ) ) :
8
9 /**
10 * Handles the Mega Menu > Menu Settings page
11 */
12 class Mega_Menu_General {
13
14 /**
15 * Constructor
16 *
17 * @since 1.0
18 */
19 public function __construct() {
20 add_action( 'admin_post_megamenu_save_settings', array( $this, 'save_settings' ) );
21
22 add_filter( 'megamenu_menu_tabs', array( $this, 'add_general_tab' ), 4 );
23 add_action( 'megamenu_page_general_settings', array( $this, 'general_settings_page' ) );
24 }
25
26
27 /**
28 * Add the Menu Locations tab to our available tabs
29 *
30 * @param array $tabs
31 * @since 2.8
32 */
33 public function add_general_tab( $tabs ) {
34 $tabs['general_settings'] = __( 'General Settings', 'megamenu' );
35 return $tabs;
36 }
37
38 /**
39 * Sanitize multidimensional array
40 *
41 * @since 2.7.5
42 */
43 public function sanitize_array( &$array ) {
44 foreach ( $array as &$value ) {
45 if ( ! is_array( $value ) ) {
46 $value = sanitize_textarea_field( $value );
47 } else {
48 $this->sanitize_array( $value );
49 }
50 }
51 return $array;
52 }
53
54
55 /**
56 * Save menu general settings.
57 *
58 * @since 1.0
59 */
60 public function save_settings() {
61 check_admin_referer( 'megamenu_save_settings' );
62
63 if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) {
64 $settings = $this->sanitize_array( $_POST['settings'] );
65 $submitted_settings = apply_filters( 'megamenu_submitted_settings', $settings );
66 $existing_settings = get_option( 'megamenu_settings' );
67 $new_settings = array_merge( (array) $existing_settings, $submitted_settings );
68
69 update_option( 'megamenu_settings', $new_settings );
70 }
71
72 delete_transient( 'megamenu_failed_to_write_css_to_filesystem' );
73
74 do_action( 'megamenu_after_save_general_settings' );
75 do_action( 'megamenu_delete_cache' );
76
77 $url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( 'admin.php?page=maxmegamenu&saved=true' );
78
79 $this->redirect( $url );
80 }
81
82
83 /**
84 * Redirect and exit
85 *
86 * @since 1.8
87 */
88 public function redirect( $url ) {
89 wp_redirect( $url );
90 exit;
91 }
92
93
94 /**
95 * Content for 'Settings' tab
96 *
97 * @since 1.4
98 */
99 public function general_settings_page( $saved_settings ) {
100
101 $css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs';
102 $js = isset( $saved_settings['js'] ) ? $saved_settings['js'] : 'footer';
103
104 $locations = get_registered_nav_menus();
105
106 ?>
107
108 <div class='menu_settings menu_settings_general_settings'>
109
110 <form action="<?php echo esc_attr( admin_url( 'admin-post.php' ) ); ?>" method="post">
111 <input type="hidden" name="action" value="megamenu_save_settings" />
112 <?php wp_nonce_field( 'megamenu_save_settings' ); ?>
113
114 <h3 class='first'><?php esc_html_e( 'General Settings', 'megamenu' ); ?></h3>
115
116 <table>
117 <tr>
118 <td class='mega-name'>
119 <?php esc_html_e( 'CSS Output', 'megamenu' ); ?>
120 <div class='mega-description'>
121 </div>
122 </td>
123 <td class='mega-value'>
124 <select name='settings[css]' id='mega_css'>
125 <option value='fs' <?php echo selected( 'fs' === $css ); ?>><?php esc_html_e( 'Save to filesystem', 'megamenu' ); ?>
126 <?php
127 if ( get_transient( 'megamenu_failed_to_write_css_to_filesystem' ) ) {
128 echo ' ' . esc_html( '(Action required: Check upload folder permissions)', 'megamenu' );
129 }
130 ?>
131 </option>
132 <option value='head' <?php echo selected( 'head' === $css ); ?>><?php esc_html_e( 'Output in &lt;head&gt;', 'megamenu' ); ?></option>
133 <option value='disabled' <?php echo selected( 'disabled' === $css ); ?>><?php esc_html_e( "Don't output CSS", 'megamenu' ); ?></option>
134 <select>
135 <div class='mega-description'>
136 <div class='fs' style='display: <?php echo 'fs' === $css ? 'block' : 'none'; ?>'><?php esc_html_e( 'CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued from there.', 'megamenu' ); ?></div>
137 <div class='head' style='display: <?php echo 'head' === $css ? 'block' : 'none'; ?>'><?php esc_html_e( 'CSS will be loaded from the cache in a &lt;style&gt; tag in the &lt;head&gt; of the page.', 'megamenu' ); ?></div>
138 <div class='disabled' style='display: <?php echo 'disabled' === $css ? 'block' : 'none'; ?>'>
139 <?php esc_html_e( 'CSS will not be output, you must enqueue the CSS for the menu manually.', 'megamenu' ); ?>
140 <div class='fail'><?php esc_html_e( 'Selecting this option will effectively disable the theme editor and many of the features available in Max Mega Menu and Max Mega Menu Pro. Only enable this option if you fully understand the consequences.', 'megamenu' ); ?>
141 </div>
142 </div>
143 </td>
144 </tr>
145 <!--tr>
146 <td class='mega-name'>
147 <?php esc_html_e( 'JavaScript Output', 'megamenu' ); ?>
148 <div class='mega-description'>
149 </div>
150 </td>
151 <td class='mega-value'>
152 <select name='settings[js]' id='mega_css'>
153 <option value='footer' <?php echo selected( 'footer' === $js ); ?>><?php esc_html_e( 'Footer (default)', 'megamenu' ); ?></option>
154 <option value='head' <?php echo selected( 'head' === $js ); ?>><?php esc_html_e( 'Output in &lt;head&gt;', 'megamenu' ); ?></option>
155 <select>
156 </td>
157 </tr-->
158 </table>
159
160 <?php do_action( 'megamenu_general_settings', $saved_settings ); ?>
161
162 <?php submit_button(); ?>
163 </form>
164 </div>
165
166 <?php
167 }
168
169 }
170
171 endif;
This diff could not be displayed because it is too large.
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access
5 }
6
7 if ( ! class_exists( 'Mega_Menu_Tools' ) ) :
8
9 /**
10 * Handles all admin related functionality.
11 */
12 class Mega_Menu_Tools {
13
14
15 /**
16 * Constructor
17 *
18 * @since 1.0
19 */
20 public function __construct() {
21 add_action( 'admin_post_megamenu_clear_css_cache', array( $this, 'tools_clear_css_cache' ) );
22 add_action( 'admin_post_megamenu_delete_data', array( $this, 'delete_data' ) );
23
24 add_filter( 'megamenu_menu_tabs', array( $this, 'add_tools_tab' ), 4 );
25 add_action( 'megamenu_page_tools', array( $this, 'tools_page' ) );
26 }
27
28 /**
29 * Add the Menu Locations tab to our available tabs
30 *
31 * @param array $tabs
32 * @since 2.8
33 */
34 public function add_tools_tab( $tabs ) {
35 $tabs['tools'] = __( 'Tools', 'megamenu' );
36 return $tabs;
37 }
38
39
40 /**
41 * Clear the CSS cache.
42 *
43 * @since 1.5
44 */
45 public function tools_clear_css_cache() {
46 check_admin_referer( 'megamenu_clear_css_cache' );
47 do_action( 'megamenu_delete_cache' );
48 $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&clear_css_cache=true' ) );
49 }
50
51
52 /**
53 * Deletes all Max Mega Menu data from the database
54 *
55 * @since 1.5
56 */
57 public function delete_data() {
58
59 check_admin_referer( 'megamenu_delete_data' );
60
61 do_action( 'megamenu_delete_cache' );
62
63 // delete options
64 delete_option( 'megamenu_settings' );
65 delete_option( 'megamenu_locations' );
66 delete_option( 'megamenu_toggle_blocks' );
67 delete_option( 'megamenu_version' );
68 delete_option( 'megamenu_initial_version' );
69 delete_option( 'megamenu_themes_last_updated' );
70 delete_option( 'megamenu_multisite_share_themes' );
71 delete_option( 'megamenu_dismissed_notices' );
72 delete_option( 'megamenu_install_date' );
73
74 // delete all widgets assigned to menus
75 $widget_manager = new Mega_Menu_Widget_Manager();
76
77 if ( $mega_menu_widgets = $widget_manager->get_mega_menu_sidebar_widgets() ) {
78 foreach ( $mega_menu_widgets as $widget_id ) {
79 $widget_manager->delete_widget( $widget_id );
80 }
81 }
82
83 // delete all mega menu metadata stored against menu items
84 delete_metadata( 'post', 0, '_megamenu', '', true );
85
86 // clear cache
87 delete_transient( 'megamenu_css' );
88
89 // delete custom themes
90 max_mega_menu_delete_themes();
91
92 $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&delete_data=true' ) );
93 }
94
95
96 /**
97 * Redirect and exit
98 *
99 * @since 1.8
100 */
101 public function redirect( $url ) {
102 wp_redirect( $url );
103 exit;
104 }
105
106
107 /**
108 * Content for 'Tools' tab
109 *
110 * @since 1.4
111 */
112 public function tools_page( $saved_settings ) {
113 $this->print_messages();
114
115 ?>
116
117 <div class='menu_settings menu_settings_tools'>
118 <h3 class='first'><?php _e( 'Tools', 'megamenu' ); ?></h3>
119 <table>
120 <tr>
121 <td class='mega-name'>
122 <?php _e( 'Cache', 'megamenu' ); ?>
123 <div class='mega-description'><?php _e( 'The CSS for your menu is updated each time a menu or a menu theme is changed. You can force the menu CSS to be updated using this tool.', 'megamenu' ); ?></div>
124 </td>
125 <td class='mega-value'>
126 <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post">
127 <?php wp_nonce_field( 'megamenu_clear_css_cache' ); ?>
128 <input type="hidden" name="action" value="megamenu_clear_css_cache" />
129
130 <input type='submit' class='button button-primary' value='<?php _e( 'Clear CSS Cache', 'megamenu' ); ?>' />
131
132 <?php if ( get_transient( 'megamenu_css_last_updated' ) ) : ?>
133 <p><em><small><?php echo sprintf( __( 'The menu CSS was last updated on %s', 'megamenu' ), date( 'l jS F Y H:i:s', get_transient( 'megamenu_css_last_updated' ) ) ); ?><small><em></p>
134 <?php endif; ?>
135 </form>
136 </td>
137 </tr>
138 <tr>
139 <td class='mega-name'>
140 <?php _e( 'Plugin Data', 'megamenu' ); ?>
141 <div class='mega-description'><?php _e( 'Delete all saved Max Mega Menu plugin data from the database. Use with caution!', 'megamenu' ); ?></div>
142 </td>
143 <td class='mega-value'>
144 <form action="<?php echo admin_url( 'admin-post.php' ); ?>" method="post">
145 <?php wp_nonce_field( 'megamenu_delete_data' ); ?>
146 <input type="hidden" name="action" value="megamenu_delete_data" />
147
148 <input type='submit' class='button button-secondary confirm' value='<?php _e( 'Delete Data', 'megamenu' ); ?>' />
149 </form>
150 </td>
151 </tr>
152 </table>
153 </div>
154
155 <?php
156 }
157
158
159 /**
160 * Display messages to the user
161 *
162 * @since 1.0
163 */
164 public function print_messages() {
165 if ( isset( $_GET['clear_css_cache'] ) && $_GET['clear_css_cache'] == 'true' ) {
166 ?>
167 <div class="notice notice-success is-dismissible">
168 <p><?php esc_html_e( 'The cache has been cleared and the menu CSS has been regenerated.', 'megamenu' ) ?></p>
169
170 <?php
171 $theme_class = new Mega_Menu_Themes();
172
173 $theme_class->show_cache_warning();
174 ?>
175 </div>
176 <?php
177 }
178
179 if ( isset( $_GET['delete_data'] ) && $_GET['delete_data'] == 'true' ) {
180 ?>
181 <div class="notice notice-success is-dismissible">
182 <p><?php _e( 'All plugin data removed', 'megamenu' ) ?></p>
183 </div>
184 <?php
185 }
186 }
187 }
188
189 endif;
This diff could not be displayed because it is too large.
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access
5 }
6
7 if ( ! class_exists( 'Mega_Menu_Walker' ) ) :
8
9 /**
10 * @package WordPress
11 * @since 1.0.0
12 * @uses Walker
13 */
14 class Mega_Menu_Walker extends Walker_Nav_Menu {
15
16
17 /**
18 * Starts the list before the elements are added.
19 *
20 * @see Walker::start_lvl()
21 *
22 * @since 1.0
23 *
24 * @param string $output Passed by reference. Used to append additional content.
25 * @param int $depth Depth of menu item. Used for padding.
26 * @param array $args An array of arguments. @see wp_nav_menu()
27 */
28 function start_lvl( &$output, $depth = 0, $args = array() ) {
29
30 $indent = str_repeat( "\t", $depth );
31
32 $output .= "\n$indent<ul class=\"mega-sub-menu\">\n";
33 }
34
35 /**
36 * Ends the list of after the elements are added.
37 *
38 * @see Walker::end_lvl()
39 *
40 * @since 1.0
41 *
42 * @param string $output Passed by reference. Used to append additional content.
43 * @param int $depth Depth of menu item. Used for padding.
44 * @param array $args An array of arguments. @see wp_nav_menu()
45 */
46 function end_lvl( &$output, $depth = 0, $args = array() ) {
47 $indent = str_repeat( "\t", $depth );
48 $output .= "$indent</ul>\n";
49 }
50
51 /**
52 * Custom walker. Add the widgets into the menu.
53 *
54 * @see Walker::start_el()
55 *
56 * @since 1.0
57 *
58 * @param string $output Passed by reference. Used to append additional content.
59 * @param object $item Menu item data object.
60 * @param int $depth Depth of menu item. Used for padding.
61 * @param array $args An array of arguments. @see wp_nav_menu()
62 * @param int $id Current item ID.
63 */
64 function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
65
66 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
67
68 if ( property_exists( $item, 'megamenu_settings' ) ) {
69 $settings = $item->megamenu_settings;
70 } else {
71 $settings = Mega_Menu_Nav_Menus::get_menu_item_defaults();
72 }
73
74 // Item Class
75 $classes = empty( $item->classes ) ? array() : (array) $item->classes;
76
77 if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) {
78 $classes[] = 'menu-item-' . $item->ID;
79 }
80
81 $class = join( ' ', apply_filters( 'megamenu_nav_menu_css_class', array_filter( $classes ), $item, $args ) );
82
83 // these classes are prepended with 'mega-'
84 $mega_classes = explode( ' ', $class );
85
86 // strip widget classes back to how they're intended to be output
87 $class = str_replace( 'mega-menu-widget-class-', '', $class );
88
89 // Item ID
90 if ( is_array( $classes ) && ! in_array( 'menu-column', $classes ) && ! in_array( 'menu-row', $classes ) ) {
91 $id = "mega-menu-item-{$item->ID}";
92 } else {
93 $id = "mega-menu-{$item->ID}";
94 }
95
96 $id = esc_attr( apply_filters( 'megamenu_nav_menu_item_id', $id, $item, $args ) );
97
98 $output .= "<li class='{$class}' id='{$id}'>";
99
100 // output the widgets
101 if ( $item->type == 'widget' ) {
102
103 if ( $item->content ) {
104 $item_output = $item->content;
105 } else {
106 $item_output = "<!-- widget is empty -->";
107 }
108
109 //} else if ( 'block' === $item->type ) {
110 // /** This filter is documented in wp-includes/post-template.php */
111 // $item_output = apply_filters( 'the_content', $item->content );
112 } else {
113
114 $atts = array();
115
116 $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
117 $atts['target'] = ! empty( $item->target ) ? $item->target : '';
118 $atts['class'] = '';
119 $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
120
121 if ( isset( $settings['disable_link'] ) && $settings['disable_link'] != 'true' ) {
122 $atts['href'] = ! empty( $item->url ) ? $item->url : '';
123 } else {
124 $atts['tabindex'] = 0;
125 }
126
127 if ( isset( $settings['icon'] ) && $settings['icon'] != 'disabled' && $settings['icon'] != 'custom' ) {
128 $atts['class'] = $settings['icon'];
129 }
130
131 if ( isset( $settings['icon'] ) && $settings['icon'] == 'custom' ) {
132 $atts['class'] = 'mega-custom-icon';
133 }
134
135 if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) && $item->parent_submenu_type == 'flyout' ) {
136
137 if ( ! defined('MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW') || !MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW ) {
138 $atts['aria-haspopup'] = 'true'; // required for Surface/Win10/Edge
139 $atts['aria-expanded'] = 'false';
140
141 if ( is_array( $mega_classes ) && in_array( 'mega-toggle-on', $mega_classes ) ) {
142 $atts['aria-expanded'] = 'true';
143 }
144 }
145
146 if ( isset( $settings['disable_link'] ) && $settings['disable_link'] == 'true' ) {
147 $atts['role'] = 'button';
148 }
149 }
150
151 if ( is_array( $classes ) && in_array( 'current-menu-item', $classes ) ) {
152 $atts['aria-current'] = 'page';
153 }
154
155 if ( $depth == 0 ) {
156 $atts['tabindex'] = '0';
157 }
158
159 if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) {
160 $atts['aria-label'] = $item->title;
161 }
162
163 $atts = apply_filters( 'megamenu_nav_menu_link_attributes', $atts, $item, $args );
164
165 if ( isset( $atts['class'] ) && strlen( $atts['class'] ) ) {
166 $atts['class'] = $atts['class'] . ' mega-menu-link';
167 } else {
168 $atts['class'] = 'mega-menu-link';
169 }
170
171
172
173 $attributes = '';
174
175 foreach ( $atts as $attr => $value ) {
176 if ( strlen( $value ) ) {
177 $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
178 $attributes .= ' ' . $attr . '="' . $value . '"';
179 }
180 }
181
182 $item_output = $args->before;
183 $item_output .= '<a' . $attributes . '>';
184
185 if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) {
186 $item_output .= "<span class='mega-title-below'>";
187 }
188
189 if ( isset( $settings['hide_text'] ) && $settings['hide_text'] == 'true' ) {
190 /**
191 * This filter is documented in wp-includes/post-template.php
192 */
193 } elseif ( property_exists( $item, 'mega_description' ) && strlen( $item->mega_description ) ) {
194 $item_output .= '<span class="mega-description-group"><span class="mega-menu-title">' . $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after . '</span><span class="mega-menu-description">' . $item->description . '</span></span>';
195 } else {
196 $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after;
197 }
198
199 if ( is_array( $classes ) && in_array( 'icon-top', $classes ) ) {
200 $item_output .= '</span>';
201 }
202
203 if ( defined('MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW') && MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW ) {
204 $item_output .= '</a>';
205 }
206
207 if ( is_array( $classes ) && in_array( 'menu-item-has-children', $classes ) ) {
208
209 $item_output .= '<span class="mega-indicator"';
210
211 $indicator_atts = array();
212
213 if ( defined('MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW') && MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW ) {
214 $indicator_atts['tabindex'] = '0';
215 $indicator_atts['role'] = 'button';
216 $indicator_atts['aria-label'] = esc_attr( apply_filters( 'megamenu_the_title', $item->title, $item->ID ) ) . " " . esc_html( 'submenu', 'megamenu' );
217 $indicator_atts['aria-haspopup'] = 'true'; // required for Surface/Win10/Edge
218 $indicator_atts['aria-expanded'] = 'false';
219
220 if ( is_array( $mega_classes ) && in_array( 'mega-toggle-on', $mega_classes ) ) {
221 $indicator_atts['aria-expanded'] = 'true';
222 }
223 }
224
225 $indicator_atts = apply_filters( 'megamenu_indicator_atts', $indicator_atts, $item, $args, $mega_classes );
226
227 foreach ( $indicator_atts as $attr => $value ) {
228 if ( strlen( $value ) ) {
229 $item_output .= ' ' . $attr . '="' . esc_attr( $value ) . '"';
230 }
231 }
232
233 $item_output .= "></span>";
234 }
235
236 if ( ! defined('MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW') || !MEGAMENU_EXPERIMENTAL_TABBABLE_ARROW ) {
237 $item_output .= '</a>';
238 }
239
240 $item_output .= $args->after;
241
242 if ( is_array( $classes ) && ( in_array( 'menu-column', $classes ) || in_array( 'menu-row', $classes ) ) ) {
243 $item_output = '';
244 }
245 }
246
247 $output .= apply_filters( 'megamenu_walker_nav_menu_start_el', $item_output, $item, $depth, $args );
248 }
249
250 /**
251 * Ends the element output, if needed.
252 *
253 * @see Walker::end_el()
254 *
255 * @since 1.7
256 *
257 * @param string $output Passed by reference. Used to append additional content.
258 * @param object $item Page data object. Not used.
259 * @param int $depth Depth of page. Not Used.
260 * @param array $args An array of arguments. @see wp_nav_menu()
261 */
262 public function end_el( &$output, $item, $depth = 0, $args = array() ) {
263 $output .= '</li>'; // remove new line to remove the 4px gap between menu items
264 }
265 }
266
267 endif;
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access
5 }
6
7 if ( ! class_exists( 'Mega_Menu_Widget_Elementor_Template' ) ) :
8
9 /**
10 * Outputs an Elementor template
11 */
12 class Mega_Menu_Widget_Elementor_Template extends WP_Widget {
13
14 /**
15 * Register widget with WordPress.
16 */
17 public function __construct() {
18 parent::__construct(
19 'maxmegamenu_elementor_template', // Base ID
20 'Elementor Template', // Name
21 array( 'description' => __( 'Outputs a saved Elementor template.', 'megamenu' ) ) // Args
22 );
23 }
24
25
26 /**
27 * Front-end display of widget.
28 *
29 * @since 2.7.4
30 * @see WP_Widget::widget()
31 * @param array $args Widget arguments.
32 * @param array $instance Saved values from database.
33 */
34 public function widget( $args, $instance ) {
35 if ( empty( $instance['template_id'] ) || ! get_post_type( $instance['template_id'] ) ) {
36 return;
37 }
38
39 extract( $args );
40
41 echo $before_widget;
42
43 $contentElementor = '';
44
45 if ( class_exists( '\\Elementor\\Plugin' ) ) {
46 $pluginElementor = \Elementor\Plugin::instance();
47 $contentElementor = $pluginElementor->frontend->get_builder_content( $instance['template_id'] );
48 }
49
50 echo $contentElementor;
51
52 echo $after_widget;
53 }
54
55
56 /**
57 * Sanitize widget form values as they are saved.
58 *
59 * @since 2.7.4
60 * @see WP_Widget::update()
61 * @param array $new_instance Values just sent to be saved.
62 * @param array $old_instance Previously saved values from database.
63 * @return array Updated safe values to be saved.
64 */
65 public function update( $new_instance, $old_instance ) {
66 $instance = array();
67 $instance['template_id'] = ! empty( $new_instance['template_id'] ) ? $new_instance['template_id'] : 0;
68
69 return $instance;
70 }
71
72
73 /**
74 * Back-end widget form.
75 *
76 * @since 2.7.4
77 * @see WP_Widget::form()
78 * @param array $instance Previously saved values from database.
79 */
80 public function form( $instance ) {
81 $template_id = ! empty( $instance['template_id'] ) ? absint( $instance['template_id'] ) : 0;
82
83 $widget_title = $template_id ? get_post_field( 'post_title', $template_id ) : '';
84
85 $posts = get_posts(
86 array(
87 'post_type' => 'elementor_library',
88 'post_status' => 'publish',
89 'numberposts' => -1,
90 )
91 );
92
93 // No blocks found.
94 if ( empty( $posts ) ) {
95 printf( '<p>%s</p>', __( 'No Elementor Templates found.', 'megamenu' ) );
96
97 return;
98 }
99
100 // Input field with id is required for WordPress to display the title in the widget header.
101 ?>
102 <input type="hidden" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" value="<?php echo esc_attr( $widget_title ); ?>">
103
104 <p>
105 <label for="<?php echo esc_attr( $this->get_field_id( 'template_id' ) ); ?>"><?php esc_attr_e( 'Template', 'megamenu' ); ?>:</label>
106 <select id="<?php echo esc_attr( $this->get_field_id( 'template_id' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'template_id' ) ); ?>">
107 <option value=""><?php esc_html_e( '- Select -', 'megamenu' ); ?></option>
108 <?php foreach ( $posts as $post ) : ?>
109
110
111 <?php
112 $elementor_data = get_post_meta( $instance['template_id'], '_elementor_data' );
113
114 $type = $elementor_data['elType'];
115
116 ?>
117 <option value="<?php echo esc_attr( $post->ID ); ?>"<?php selected( $post->ID, $template_id ); ?>>
118 <?php echo esc_html( $post->post_title . ' (' . $post->ID . ' - ' . get_post_meta( $post->ID, '_elementor_template_type', true ) . ')' ); ?></option>
119 <?php endforeach; ?>
120 </select>
121 </p>
122
123 <?php
124 }
125
126 }
127
128 endif;
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access
5 }
6
7 if ( ! class_exists( 'Mega_Menu_Widget_Reusable_Block' ) ) :
8
9 /**
10 * Outputs a reusable block
11 *
12 * Credit: Based on https://wordpress.org/plugins/block-widget/ by Maarten Menten
13 */
14 class Mega_Menu_Widget_Reusable_Block extends WP_Widget {
15
16 /**
17 * Register widget with WordPress.
18 */
19 public function __construct() {
20 parent::__construct(
21 'maxmegamenu_reusable_block', // Base ID
22 'Reusable Block (MMM)', // Name
23 array( 'description' => __( 'Outputs a reusable block.', 'megamenu' ) ) // Args
24 );
25 }
26
27
28 /**
29 * Front-end display of widget.
30 *
31 * @since 2.7.4
32 * @see WP_Widget::widget()
33 * @param array $args Widget arguments.
34 * @param array $instance Saved values from database.
35 */
36 public function widget( $args, $instance ) {
37 if ( empty( $instance['block'] ) || ! get_post_type( $instance['block'] ) ) {
38 return;
39 }
40
41 extract( $args );
42
43 echo $before_widget;
44
45 echo do_blocks( get_post_field( 'post_content', $instance['block'] ) );
46
47 echo $after_widget;
48 }
49
50
51 /**
52 * Sanitize widget form values as they are saved.
53 *
54 * @since 2.7.4
55 * @see WP_Widget::update()
56 * @param array $new_instance Values just sent to be saved.
57 * @param array $old_instance Previously saved values from database.
58 * @return array Updated safe values to be saved.
59 */
60 public function update( $new_instance, $old_instance ) {
61 $instance = array();
62 $instance['block'] = ! empty( $new_instance['block'] ) ? $new_instance['block'] : 0;
63
64 return $instance;
65 }
66
67
68 /**
69 * Back-end widget form.
70 *
71 * @since 2.7.4
72 * @see WP_Widget::form()
73 * @param array $instance Previously saved values from database.
74 */
75 public function form( $instance ) {
76 $block_id = ! empty( $instance['block'] ) ? absint( $instance['block'] ) : 0;
77
78 $widget_title = $block_id ? get_post_field( 'post_title', $block_id ) : '';
79
80 $posts = get_posts(
81 array(
82 'post_type' => 'wp_block',
83 'post_status' => 'publish',
84 'numberposts' => -1,
85 )
86 );
87
88 // No blocks found.
89 if ( empty( $posts ) ) {
90 printf( '<p>%s</p>', __( 'No reusable blocks available.', 'megamenu' ) );
91
92 return;
93 }
94
95 // Input field with id is required for WordPress to display the title in the widget header.
96 ?>
97 <input type="hidden" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" value="<?php echo esc_attr( $widget_title ); ?>">
98
99 <p>
100 <label for="<?php echo esc_attr( $this->get_field_id( 'block' ) ); ?>"><?php esc_attr_e( 'Block', 'megamenu' ); ?>:</label>
101 <select id="<?php echo esc_attr( $this->get_field_id( 'block' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'block' ) ); ?>">
102 <option value=""><?php esc_html_e( '- Select -', 'megamenu' ); ?></option>
103 <?php foreach ( $posts as $post ) : ?>
104 <option value="<?php echo esc_attr( $post->ID ); ?>"<?php selected( $post->ID, $block_id ); ?>><?php echo esc_html( $post->post_title ); ?></option>
105 <?php endforeach; ?>
106 </select>
107 </p>
108
109 <?php
110 }
111
112 }
113
114 endif;
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access
5 }
6
7 if ( ! class_exists( 'Mega_Menu_Widget' ) ) :
8
9 /**
10 * Outputs a registered menu location using wp_nav_menu
11 */
12 class Mega_Menu_Widget extends WP_Widget {
13
14 /**
15 * Register widget with WordPress.
16 */
17 public function __construct() {
18 parent::__construct(
19 'maxmegamenu', // Base ID
20 __( 'Max Mega Menu', 'megamenu' ), // Name
21 array( 'description' => __( 'Outputs a menu for a selected theme location.', 'megamenu' ) ) // Args
22 );
23 }
24
25 /**
26 * Front-end display of widget.
27 *
28 * @since 1.7.4
29 * @see WP_Widget::widget()
30 * @param array $args Widget arguments.
31 * @param array $instance Saved values from database.
32 */
33 public function widget( $args, $instance ) {
34 if ( ! is_array( $args ) ) {
35 $args = array(
36 'before_widget' => '',
37 'after_widget' => '',
38 );
39 }
40
41 extract( $args );
42
43 if ( isset( $instance['location'] ) ) {
44 $location = $instance['location'];
45
46 $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : "";
47
48 echo $before_widget;
49
50 if ( ! empty( $title ) ) {
51 echo $before_title . $title . $after_title;
52 }
53
54 if ( has_nav_menu( $location ) ) {
55 wp_nav_menu( array( 'theme_location' => $location ) );
56 }
57
58 echo $after_widget;
59 }
60 }
61
62 /**
63 * Sanitize widget form values as they are saved.
64 *
65 * @since 1.7.4
66 * @see WP_Widget::update()
67 * @param array $new_instance Values just sent to be saved.
68 * @param array $old_instance Previously saved values from database.
69 * @return array Updated safe values to be saved.
70 */
71 public function update( $new_instance, $old_instance ) {
72 $instance = array();
73 $instance['location'] = strip_tags( $new_instance['location'] );
74 $instance['title'] = strip_tags( $new_instance['title'] );
75
76 return $instance;
77 }
78
79 /**
80 * Back-end widget form.
81 *
82 * @since 1.7.4
83 * @see WP_Widget::form()
84 * @param array $instance Previously saved values from database.
85 */
86 public function form( $instance ) {
87
88 $selected_location = 0;
89 $title = '';
90 $locations = get_registered_nav_menus();
91
92 if ( isset( $instance['location'] ) ) {
93 $selected_location = $instance['location'];
94 }
95
96 if ( isset( $instance['title'] ) ) {
97 $title = $instance['title'];
98 }
99
100 ?>
101 <p>
102 <?php if ( $locations ) { ?>
103 <p>
104 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'megamenu' ); ?></label>
105 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
106 </p>
107 <label for="<?php echo $this->get_field_id( 'location' ); ?>"><?php _e( 'Menu Location:', 'megamenu' ); ?></label>
108
109 <select id="<?php echo $this->get_field_id( 'location' ); ?>" name="<?php echo $this->get_field_name( 'location' ); ?>">
110 <?php
111 if ( $selected_location === 0 ) {
112 echo "<option selected='true' disabled='disabled'>" . __( 'Select location', 'megamenu' ) . '</option>';
113 }
114 ?>
115
116 <?php
117
118 $enabled_locations = array();
119 $disabled_locations = array();
120
121 foreach ( $locations as $location => $description ) {
122 if ( max_mega_menu_is_enabled( $location ) ) {
123 $enabled_locations[ $location ] = $description;
124 } else {
125 $disabled_locations[ $location ] = $description;
126 }
127 }
128
129 if ( count( $enabled_locations ) ) {
130 echo "<optgroup label='&#10003; " . __( 'Active locations', 'megamenu' ) . "'>";
131
132 foreach ( $enabled_locations as $location => $description ) {
133 echo "<option value='{$location}'" . selected( $location, $selected_location ) . ">{$description}</option>";
134 }
135
136 echo '</optgroup>';
137 }
138
139 if ( count( $disabled_locations ) ) {
140 echo "<optgroup label='&#x2718; " . __( 'Inactive locations', 'megamenu' ) . "'>";
141
142 foreach ( $disabled_locations as $location => $description ) {
143 echo "<option value='{$location}'" . selected( $location, $selected_location ) . ">{$description}</option>";
144 }
145
146 echo '</optgroup>';
147 }
148 ?>
149 </select>
150 <?php
151 } else {
152 _e( 'No menu locations found', 'megamenu' );
153 }
154 ?>
155 </p>
156 <?php
157 }
158 }
159
160 endif;
This diff could not be displayed because it is too large.
1 @if ($elementor_pro_active == true) {
2 .elementor-sticky__spacer #{$wrap} #{$menu},
3 .elementor-sticky__spacer #{$wrap} #{$menu} .mega-sub-menu {
4 visibility: inherit !important;
5 }
6 }
7
8 @if ($wp_theme == twentytwelve and $location == 'primary') {
9 body.mega-menu-primary button.menu-toggle {
10 display: none;
11 }
12 }
13
14 @if ($wp_theme == generatepress and $location == 'primary') {
15 body.mega-menu-primary button.menu-toggle {
16 display: none;
17 }
18 }
19
20 @if ($wp_theme == astra and $location == 'primary') {
21 body.mega-menu-primary.ast-header-break-point .ast-mobile-menu-buttons {
22 display: none;
23 }
24
25 @include desktop {
26 #{$wrap} #{$menu} .ast-masthead-custom-menu-items {
27 display: inline-block;
28 margin: 0 $menu_item_spacing 0 0;
29 }
30 }
31 }
32
33 @if ($wp_theme == oceanwp) {
34 html[class$="-off-canvas-open"] #top-bar-wrap,
35 html[class$="-off-canvas-open"] #site-header {
36 z-index: 1;
37 }
38
39 @if ($location == main_menu) {
40 @include desktop {
41 #{$wrap} #{$menu} .woo-menu-icon,
42 #{$wrap} #{$menu} .search-toggle-li {
43 display: inline-block;
44 margin: 0 $menu_item_spacing 0 0;
45
46 > a {
47 line-height: $menu_item_link_height;
48 height: $menu_item_link_height;
49 padding: $menu_item_link_padding_top $menu_item_link_padding_right $menu_item_link_padding_bottom $menu_item_link_padding_left;
50 }
51 }
52 }
53 }
54 }
55
56 @if ($wp_theme == enfold) {
57 html[class$="-off-canvas-open"] #header_meta {
58 z-index: 1;
59 }
60 }
...\ No newline at end of file ...\ No newline at end of file
1 @mixin border-radius($topleft: 0, $topright: 0, $bottomright: 0, $bottomleft: 0) {
2 @if $topleft == 0 and $topright == 0 and $bottomright == 0 and $bottomleft == 0 {
3 border-radius: 0;
4 } @else if $topleft == 0px and $topright == 0px and $bottomright == 0px and $bottomleft == 0px {
5 border-radius: 0;
6 } @else {
7 border-radius: $topleft $topright $bottomright $bottomleft;
8 }
9 }
10
11 @mixin box-shadow($value) {
12 box-shadow: $value;
13 }
14
15 @mixin background($from, $to) {
16 @if $to == $from {
17 background: $to;
18 } @else {
19 background: $to;
20 background: linear-gradient(to bottom, $from, $to);
21 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie_hex_str($from)}', endColorstr='#{ie_hex_str($to)}');
22 }
23 }
24
25 @mixin border($top, $left, $right, $bottom, $color) {
26 @if $top == 0px and $left == 0px and $right == 0px and $bottom == 0px {
27 border: 0;
28 } @else {
29 border-top: $top solid $color;
30 border-left: $left solid $color;
31 border-right: $right solid $color;
32 border-bottom: $bottom solid $color;
33 }
34 }
35
36 @mixin mobile {
37 @media only screen and (max-width : $responsive_breakpoint) {
38 @content;
39 }
40 }
41
42 @mixin desktop {
43 @media only screen and (min-width : $responsive_breakpoint + 1) {
44 @content;
45 }
46 }
47
1 @if $resets == 'on' {
2 #{$wrap} #{$menu} ul,
3 #{$wrap} #{$menu} li,
4 #{$wrap} #{$menu} p,
5 #{$wrap} #{$menu} img:not(.mega-menu-logo),
6 #{$wrap} #{$menu} div,
7 #{$wrap} #{$menu} a {
8 color: $panel_font_color;
9 font-family: unquote($panel_font_family);
10 font-size: $panel_font_size;
11 background: none;
12 border: 0;
13 @include border-radius(0, 0, 0, 0);
14 margin: 0;
15 opacity: 1;
16 padding: 0;
17 position: relative;
18 right: auto;
19 top: auto;
20 bottom: auto;
21 left: auto;
22 text-align: left;
23 text-transform: none;
24 vertical-align: baseline;
25 @include box-shadow(none);
26 list-style-type: none;
27 line-height: $line_height;
28 box-sizing: border-box;
29 float: none;
30 overflow: visible;
31 display: block;
32 min-height: 0;
33 -webkit-transition: none;
34 -moz-transition: none;
35 -o-transition: none;
36 transition: none;
37 text-decoration: none;
38 width: auto;
39 clip: auto;
40 height: auto;
41 outline: none;
42 visibility: inherit;
43 pointer-events: auto;
44
45 &:before,
46 &:after {
47 display: none;
48 }
49 }
50
51 #{$wrap} #{$menu} table,
52 #{$wrap} #{$menu} td,
53 #{$wrap} #{$menu} tr,
54 #{$wrap} #{$menu} th {
55 border: 0;
56 margin: 0;
57 padding: 0;
58 background: none;
59 }
60 }
...\ No newline at end of file ...\ No newline at end of file
1 #{$wrap} .mega-menu-toggle {
2 @each $item in $menu_toggle_blocks {
3 $id: nth($item, 1);
4 $align: nth($item, 2);
5 $closed_text: nth($item, 3);
6 $open_text: nth($item, 4);
7 $closed_icon: nth($item, 5);
8 $open_icon: nth($item, 6);
9 $text_color: nth($item, 7);
10 $icon_color: nth($item, 8);
11 $icon_position: nth($item, 9);
12 $text_size: nth($item, 10);
13 $icon_size: nth($item, 11);
14
15 @if type-of($id) == number {
16
17 .mega-toggle-block-#{$id} {
18 cursor: pointer;
19
20 @if $icon_position == before {
21 &:before {
22 content: $closed_icon;
23 font-family: 'dashicons';
24 font-size: $icon_size;
25 color: $icon_color;
26 margin: 0 5px 0 0;
27 }
28 } @else {
29 &:after {
30 content: $closed_icon;
31 font-family: 'dashicons';
32 font-size: $icon_size;
33 color: $icon_color;
34 margin: 0 0 0 5px;
35 }
36 }
37
38 .mega-toggle-label {
39 color: $text_color;
40 font-size: $text_size;
41
42 .mega-toggle-label-open {
43 display: none;
44 }
45
46 .mega-toggle-label-closed {
47 display: inline;
48 }
49 }
50 }
51
52 &.mega-menu-open {
53
54 .mega-toggle-block-#{$id} {
55 @if $icon_position == before {
56 &:before {
57 content: $open_icon;
58 }
59 } @else {
60 &:after {
61 content: $open_icon;
62 }
63 }
64
65 .mega-toggle-label-open {
66 display: inline;
67 }
68 .mega-toggle-label-closed {
69 display: none;
70 }
71 }
72 }
73 }
74 }
75
76 @each $item in $spacer_toggle_blocks {
77
78 $id: nth($item, 1);
79 $align: nth($item, 2);
80 $width: nth($item, 3);
81
82 @if type-of($id) == number {
83
84 .mega-toggle-block-#{$id} {
85 width: $width;
86 margin: 0;
87 }
88
89 }
90
91 }
92
93 @each $item in $menu_toggle_animated_blocks {
94
95 $id: nth($item, 1);
96 $scale: nth($item, 2);
97 $color: nth($item, 3);
98
99 @if type-of($id) == number {
100
101 .mega-toggle-block-#{$id} {
102 cursor: pointer;
103
104 /*!
105 * Hamburgers
106 * @description Tasty CSS-animated hamburgers
107 * @author Jonathan Suh @jonsuh
108 * @site https://jonsuh.com/hamburgers
109 * @link https://github.com/jonsuh/hamburgers
110 */
111 .mega-toggle-animated {
112 padding: 0;
113 display: -webkit-box;
114 display: -ms-flexbox;
115 display: -webkit-flex;
116 display: flex;
117 cursor: pointer;
118 transition-property: opacity, filter;
119 transition-duration: 0.15s;
120 transition-timing-function: linear;
121 font: inherit;
122 color: inherit;
123 text-transform: none;
124 background-color: transparent;
125 border: 0;
126 margin: 0;
127 overflow: visible;
128 transform: scale($scale);
129 align-self: center;
130 outline: 0;
131 background: none;
132 }
133 .mega-toggle-animated-box {
134 width: 40px;
135 height: 24px;
136 display: inline-block;
137 position: relative;
138 outline: 0;
139 }
140 .mega-toggle-animated-inner {
141 display: block;
142 top: 50%;
143 margin-top: -2px;
144 }
145 .mega-toggle-animated-inner,
146 .mega-toggle-animated-inner::before,
147 .mega-toggle-animated-inner::after {
148 width: 40px;
149 height: 4px;
150 background-color: $color;
151 border-radius: 4px;
152 position: absolute;
153 transition-property: transform;
154 transition-duration: 0.15s;
155 transition-timing-function: ease;
156 }
157 .mega-toggle-animated-inner::before,
158 .mega-toggle-animated-inner::after {
159 content: "";
160 display: block;
161 }
162 .mega-toggle-animated-inner::before {
163 top: -10px;
164 }
165 .mega-toggle-animated-inner::after {
166 bottom: -10px;
167 }
168 .mega-toggle-animated-slider .mega-toggle-animated-inner {
169 top: 2px;
170 }
171 .mega-toggle-animated-slider .mega-toggle-animated-inner::before {
172 top: 10px;
173 transition-property: transform, opacity;
174 transition-timing-function: ease;
175 transition-duration: 0.15s;
176 }
177 .mega-toggle-animated-slider .mega-toggle-animated-inner::after {
178 top: 20px;
179 }
180
181 }
182
183 &.mega-menu-open .mega-toggle-block-#{$id} {
184 .mega-toggle-animated-slider .mega-toggle-animated-inner {
185 transform: translate3d(0, 10px, 0) rotate(45deg);
186 }
187 .mega-toggle-animated-slider .mega-toggle-animated-inner::before {
188 transform: rotate(-45deg) translate3d(-5.71429px, -6px, 0);
189 opacity: 0;
190 }
191 .mega-toggle-animated-slider .mega-toggle-animated-inner::after {
192 transform: translate3d(0, -20px, 0) rotate(-90deg);
193 }
194 }
195 }
196 }
197 }
...\ No newline at end of file ...\ No newline at end of file
1 var gulp = require('gulp');
2 var sass = require('gulp-sass');
3
4 gulp.task('styles', function() {
5 gulp.src('css/admin/*.scss')
6 .pipe(sass().on('error', sass.logError))
7 .pipe(gulp.dest('./css/admin/'));
8 });
9
10 gulp.task('default',function() {
11 gulp.watch('css/admin/*.scss',['styles']);
12 });
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 /**
3 * Registers the block using the metadata loaded from the `block.json` file.
4 * Behind the scenes, it registers also all assets so they can be enqueued
5 * through the block editor in the corresponding context.
6 *
7 * @see https://developer.wordpress.org/reference/functions/register_block_type/
8 */
9 function maxmegamenu_location_block_init() {
10 register_block_type(
11 __DIR__ . '/build',
12 array(
13 'attributes' => array(
14 'location' => array(
15 'type' => 'string'
16 )
17 ),
18 'render_callback' => 'maxmegamenu_render_callback',
19 )
20 );
21
22 $locations = array_merge(
23 array( "" => __('Select a location', 'megamenu') ),
24 get_registered_nav_menus()
25 );
26
27 wp_localize_script( 'maxmegamenu-location-editor-script', 'max_mega_menu_locations', $locations );
28 }
29 add_action( 'init', 'maxmegamenu_location_block_init' );
30
31
32 /**
33 * Enqueue the menu style.css file on block enabled pages
34 */
35 function maxmegamenu_block_assets() {
36 $style_manager = new Mega_Menu_Style_Manager;
37 $style_manager->enqueue_fs_style();
38 }
39 add_action( 'enqueue_block_editor_assets', 'maxmegamenu_block_assets' );
40
41 /**
42 * Render callback function.
43 *
44 * @param array $attributes The block attributes.
45 * @param string $content The block content.
46 * @param WP_Block $block Block instance.
47 *
48 * @return string The rendered output.
49 */
50 function maxmegamenu_render_callback( $attributes, $content, $block ) {
51 if ( isset( $attributes['location'] ) && strlen( $attributes['location'] ) && function_exists("max_mega_menu_is_enabled") && max_mega_menu_is_enabled( $attributes['location'] ) ) {
52 $menu = wp_nav_menu( array( 'theme_location' => $attributes['location'], 'echo' => false ) );
53 } else {
54 if ( maxmegamenu_is_editing_block_on_backend() ) {
55 $menu = "<p>" . __("Go to Mega Menu > Menu Locations to enable Max Mega Menu for this location.", "megamenu") . "</p>";
56 } else {
57 $menu = "<!--" . __("Go to Mega Menu > Menu Locations to enable Max Mega Menu for this location.", "megamenu") . "-->";
58 }
59 }
60
61 return $menu;
62 }
63
64 /**
65 * props: https://github.com/WordPress/gutenberg/issues/23810#issue-653709683
66 */
67 function maxmegamenu_is_editing_block_on_backend() {
68 return defined('REST_REQUEST') && true === REST_REQUEST && 'edit' === filter_input( INPUT_GET, 'context', FILTER_SANITIZE_STRING );
69 }
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "$schema": "https://schemas.wp.org/trunk/block.json",
3 "apiVersion": 2,
4 "name": "maxmegamenu/location",
5 "version": "0.1.0",
6 "title": "Max Mega Menu",
7 "category": "widgets",
8 "icon": "menu",
9 "description": "",
10 "supports": {
11 "html": false
12 },
13 "attributes": {
14 "location": {
15 "type": "string"
16 }
17 },
18 "keywords": [
19 "navigation"
20 ],
21 "textdomain": "location",
22 "editorScript": "file:./index.js",
23 "editorStyle": "file:./index.css"
24 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '2f4ce756f88079dcc93b');
1 .wp-block-maxmegamenu-maxmegamenu:not(.is-selected) *{pointer-events:none!important}.max-mega-menu>li.mega-menu-item>a.mega-menu-link{font-family:var(--wp--preset--font-family--system-font)!important;font-weight:400!important}
1 !function(){"use strict";var e={n:function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,{a:t}),t},d:function(n,t){for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}},n=window.wp.blocks,t=window.wp.element,o=window.wp.i18n,a=window.wp.blockEditor,i=window.wp.components,r=window.wp.serverSideRender,l=e.n(r),c=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"maxmegamenu/location","version":"0.1.0","title":"Max Mega Menu","category":"widgets","icon":"menu","description":"","supports":{"html":false},"attributes":{"location":{"type":"string"}},"keywords":["navigation"],"textdomain":"location","editorScript":"file:./index.js","editorStyle":"file:./index.css"}');const{name:s}=c;(0,n.registerBlockType)(c.name,{edit:function(e){let{setAttributes:n,attributes:r,isSelected:c}=e;if(0===window.max_mega_menu_locations.length)return(0,t.createElement)("div",(0,a.useBlockProps)(),(0,o.__)("Error: max_mega_menu_locations missing.","megamenu"));const u=Object.keys(window.max_mega_menu_locations).map((e=>({value:e,label:window.max_mega_menu_locations[e]})));return 1===u.length?(0,t.createElement)("div",(0,a.useBlockProps)(),(0,o.__)("No locations found. Go to Mega Menu > Menu Locations to create a new menu location.","megamenu")):(0,t.createElement)("div",(0,a.useBlockProps)(),c||!r.location||""===r.location?(0,t.createElement)(i.Placeholder,{label:(0,o.__)("Max Mega Menu","megamenu")},(0,t.createElement)(i.SelectControl,{label:(0,o.__)("Select a location","megamenu"),options:u,value:r.location,onChange:e=>{n({location:String(e)})}})):(0,t.createElement)(i.Disabled,null,(0,t.createElement)(l(),{block:s,attributes:r})))}})}();
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 {
2 "name": "location",
3 "version": "0.1.0",
4 "author": "The WordPress Contributors",
5 "license": "GPL-2.0-or-later",
6 "main": "build/index.js",
7 "scripts": {
8 "build": "wp-scripts build --webpack-copy-php",
9 "format": "wp-scripts format",
10 "lint:css": "wp-scripts lint-style",
11 "lint:js": "wp-scripts lint-js",
12 "packages-update": "wp-scripts packages-update",
13 "plugin-zip": "wp-scripts plugin-zip",
14 "start": "wp-scripts start --webpack-copy-php"
15 },
16 "devDependencies": {
17 "@wordpress/scripts": "^24.1.0"
18 }
19 }
1 {
2 "$schema": "https://schemas.wp.org/trunk/block.json",
3 "apiVersion": 2,
4 "name": "maxmegamenu/location",
5 "version": "0.1.0",
6 "title": "Max Mega Menu",
7 "category": "widgets",
8 "icon": "menu",
9 "description": "",
10 "supports": {
11 "html": false
12 },
13 "attributes": {
14 "location": {
15 "type": "string"
16 }
17 },
18 "keywords": [ "navigation" ],
19 "textdomain": "location",
20 "editorScript": "file:./index.js",
21 "editorStyle": "file:./index.css"
22 }
1 /**
2 * Retrieves the translation of text.
3 *
4 * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
5 */
6 import { __ } from '@wordpress/i18n';
7
8 /**
9 * React hook that is used to mark the block wrapper element.
10 * It provides all the necessary props like the class name.
11 *
12 * @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
13 */
14 import { useBlockProps } from '@wordpress/block-editor';
15 import { SelectControl, Placeholder, Disabled } from '@wordpress/components';
16 import ServerSideRender from '@wordpress/server-side-render';
17 /**
18 * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
19 * Those files can contain any CSS code that gets applied to the editor.
20 *
21 * @see https://www.npmjs.com/package/@wordpress/scripts#using-css
22 */
23 import './editor.scss';
24 import metadata from './block';
25 const { name } = metadata;
26
27 /**
28 * The edit function describes the structure of your block in the context of the
29 * editor. This represents what the editor will render when the block is used.
30 *
31 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-edit-save/#edit
32 *
33 * @return {WPElement} Element to render.
34 */
35 export default function Edit( { setAttributes, attributes, isSelected } ) {
36
37 if ( window.max_mega_menu_locations.length === 0 ) {
38 return (
39 <div {...useBlockProps()}>
40 {__('Error: max_mega_menu_locations missing.', 'megamenu')}
41 </div>
42 );
43 }
44
45 const options = Object.keys(
46 window.max_mega_menu_locations
47 ).map( ( location ) => {
48 return {
49 value: location,
50 label: window.max_mega_menu_locations[location],
51 };
52 } );
53
54 if ( options.length === 1 ) {
55 return (
56 <div {...useBlockProps()}>
57 {__('No locations found. Go to Mega Menu > Menu Locations to create a new menu location.', 'megamenu')}
58 </div>
59 );
60 }
61
62 const onSaveMenu = (value) => {
63 setAttributes({location: String( value )});
64 };
65
66 return (
67 <div {...useBlockProps()}>
68 {isSelected || !attributes.location || attributes.location === '' ? (
69 <Placeholder
70 label={__('Max Mega Menu', 'megamenu')}
71 >
72 <SelectControl
73 label={__('Select a location', 'megamenu')}
74 options={options}
75 value={attributes.location}
76 onChange={onSaveMenu}
77 />
78 </Placeholder>
79 ) : (
80 <Disabled>
81 <ServerSideRender block={name} attributes={attributes} />
82 </Disabled>
83 )}
84 </div>
85 );
86 }
1 /**
2 * The following styles get applied inside the editor only.
3 */
4 .wp-block-maxmegamenu-maxmegamenu:not(.is-selected) * {
5 pointer-events: none !important;
6 }
7 .max-mega-menu > li.mega-menu-item > a.mega-menu-link {
8 font-family: var(--wp--preset--font-family--system-font) !important;
9 font-weight: normal !important;
10 }
...\ No newline at end of file ...\ No newline at end of file
1 /**
2 * Registers a new block provided a unique name and an object defining its behavior.
3 *
4 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
5 */
6 import { registerBlockType } from '@wordpress/blocks';
7
8 /**
9 * Internal dependencies
10 */
11 import Edit from './edit';
12 import metadata from './block.json';
13
14 /**
15 * Every block starts by registering a new block type definition.
16 *
17 * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
18 */
19 registerBlockType( metadata.name, {
20 /**
21 * @see ./edit.js
22 */
23 edit: Edit,
24 } );
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // disable direct access
5 }
6
7 /**
8 * Append integration CSS
9 */
10 function megamenu_twentyseventeen_style($scss) {
11 $path = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'style.scss';
12 $contents = file_get_contents( $path );
13 return $scss . $contents;
14 }
15 add_filter( 'megamenu_load_scss_file_contents', 'megamenu_twentyseventeen_style', 9999 );
16
17
18 /**
19 * TwentySeventeen JavaScript helper
20 */
21 function megamenu_twentyseventeen_script() {
22 wp_enqueue_script( "megamenu-twentyseventeen", plugins_url( 'script.js' , __FILE__ ), array('megamenu'), MEGAMENU_VERSION, true );
23 }
24 add_action( 'wp_enqueue_scripts', 'megamenu_twentyseventeen_script', 999 );
25
26
27 /**
28 * Restore menu-item class on menu items. Required for the sticky menu to work.
29 */
30 function megamenu_twentyseventeen_add_menu_item_class($classes) {
31 $classes[] = 'menu-item';
32 return $classes;
33 }
34 add_filter( 'megamenu_nav_menu_css_class', 'megamenu_twentyseventeen_add_menu_item_class', 9999 );
1 jQuery("body.mega-menu-top #mega-menu-top").on("after_mega_menu_init", function() {
2 jQuery(this).parent().parent().removeClass("main-navigation");
3 });
...\ No newline at end of file ...\ No newline at end of file
1 @if $location == 'top' {
2 body.mega-menu-top {
3 button.menu-toggle {
4 height: 0;
5 padding: 0;
6 visibility: hidden;
7 margin: 0;
8 }
9 .site-header .navigation-top .menu-scroll-down {
10 display: none;
11 }
12 .navigation-top a {
13 font-weight: normal;
14 }
15 .navigation-top .wrap {
16 padding: 0 2em;
17 }
18 .navigation-top nav {
19 margin-left: 0;
20 }
21 }
22 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 /**
4 * Zerif binds smoothscroll events to the top level menu items. Stop MMM from unbinding these events.
5 */
6 if ( ! function_exists('megamenu_dont_unbind_menu_events') ) {
7 function megamenu_dont_unbind_menu_events($attributes, $menu_id, $menu_settings, $settings, $current_theme_location) {
8
9 $attributes['data-unbind'] = "false";
10
11 return $attributes;
12 }
13 }
14 add_filter("megamenu_wrap_attributes", "megamenu_dont_unbind_menu_events", 11, 5);
...\ No newline at end of file ...\ No newline at end of file
1 /* BASICS */
2
3 .CodeMirror {
4 /* Set height, width, borders, and global font properties here */
5 font-family: monospace;
6 height: 300px;
7 }
8 .CodeMirror-scroll {
9 /* Set scrolling behaviour here */
10 overflow: auto;
11 }
12
13 /* PADDING */
14
15 .CodeMirror-lines {
16 padding: 4px 0; /* Vertical padding around content */
17 }
18 .CodeMirror pre {
19 padding: 0 4px; /* Horizontal padding of content */
20 }
21
22 .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
23 background-color: white; /* The little square between H and V scrollbars */
24 }
25
26 /* GUTTER */
27
28 .CodeMirror-gutters {
29 border-right: 1px solid #ddd;
30 background-color: #f7f7f7;
31 white-space: nowrap;
32 }
33 .CodeMirror-linenumbers {}
34 .CodeMirror-linenumber {
35 padding: 0 3px 0 5px;
36 min-width: 20px;
37 text-align: right;
38 color: #999;
39 -moz-box-sizing: content-box;
40 box-sizing: content-box;
41 }
42
43 .CodeMirror-guttermarker { color: black; }
44 .CodeMirror-guttermarker-subtle { color: #999; }
45
46 /* CURSOR */
47
48 .CodeMirror div.CodeMirror-cursor {
49 border-left: 1px solid black;
50 }
51 /* Shown when moving in bi-directional text */
52 .CodeMirror div.CodeMirror-secondarycursor {
53 border-left: 1px solid silver;
54 }
55 .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
56 width: auto;
57 border: 0;
58 background: #7e7;
59 }
60 .cm-animate-fat-cursor {
61 width: auto;
62 border: 0;
63 -webkit-animation: blink 1.06s steps(1) infinite;
64 -moz-animation: blink 1.06s steps(1) infinite;
65 animation: blink 1.06s steps(1) infinite;
66 }
67 @-moz-keyframes blink {
68 0% { background: #7e7; }
69 50% { background: none; }
70 100% { background: #7e7; }
71 }
72 @-webkit-keyframes blink {
73 0% { background: #7e7; }
74 50% { background: none; }
75 100% { background: #7e7; }
76 }
77 @keyframes blink {
78 0% { background: #7e7; }
79 50% { background: none; }
80 100% { background: #7e7; }
81 }
82
83 /* Can style cursor different in overwrite (non-insert) mode */
84 div.CodeMirror-overwrite div.CodeMirror-cursor {}
85
86 .cm-tab { display: inline-block; }
87
88 .CodeMirror-ruler {
89 border-left: 1px solid #ccc;
90 position: absolute;
91 }
92
93 /* DEFAULT THEME */
94
95 .cm-s-default .cm-keyword {color: #708;}
96 .cm-s-default .cm-atom {color: #219;}
97 .cm-s-default .cm-number {color: #164;}
98 .cm-s-default .cm-def {color: #00f;}
99 .cm-s-default .cm-variable,
100 .cm-s-default .cm-punctuation,
101 .cm-s-default .cm-property,
102 .cm-s-default .cm-operator {}
103 .cm-s-default .cm-variable-2 {color: #05a;}
104 .cm-s-default .cm-variable-3 {color: #085;}
105 .cm-s-default .cm-comment {color: #a50;}
106 .cm-s-default .cm-string {color: #a11;}
107 .cm-s-default .cm-string-2 {color: #f50;}
108 .cm-s-default .cm-meta {color: #555;}
109 .cm-s-default .cm-qualifier {color: #555;}
110 .cm-s-default .cm-builtin {color: #30a;}
111 .cm-s-default .cm-bracket {color: #997;}
112 .cm-s-default .cm-tag {color: #170;}
113 .cm-s-default .cm-attribute {color: #00c;}
114 .cm-s-default .cm-header {color: blue;}
115 .cm-s-default .cm-quote {color: #090;}
116 .cm-s-default .cm-hr {color: #999;}
117 .cm-s-default .cm-link {color: #00c;}
118
119 .cm-negative {color: #d44;}
120 .cm-positive {color: #292;}
121 .cm-header, .cm-strong {font-weight: bold;}
122 .cm-em {font-style: italic;}
123 .cm-link {text-decoration: underline;}
124
125 .cm-s-default .cm-error {color: #f00;}
126 .cm-invalidchar {color: #f00;}
127
128 /* Default styles for common addons */
129
130 div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
131 div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
132 .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
133 .CodeMirror-activeline-background {background: #e8f2ff;}
134
135 /* STOP */
136
137 /* The rest of this file contains styles related to the mechanics of
138 the editor. You probably shouldn't touch them. */
139
140 .CodeMirror {
141 line-height: 1;
142 position: relative;
143 overflow: hidden;
144 background: white;
145 color: black;
146 }
147
148 .CodeMirror-scroll {
149 /* 30px is the magic margin used to hide the element's real scrollbars */
150 /* See overflow: hidden in .CodeMirror */
151 margin-bottom: -30px; margin-right: -30px;
152 padding-bottom: 30px;
153 height: 100%;
154 outline: none; /* Prevent dragging from highlighting the element */
155 position: relative;
156 -moz-box-sizing: content-box;
157 box-sizing: content-box;
158 }
159 .CodeMirror-sizer {
160 position: relative;
161 border-right: 30px solid transparent;
162 -moz-box-sizing: content-box;
163 box-sizing: content-box;
164 }
165
166 /* The fake, visible scrollbars. Used to force redraw during scrolling
167 before actuall scrolling happens, thus preventing shaking and
168 flickering artifacts. */
169 .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
170 position: absolute;
171 z-index: 6;
172 display: none;
173 }
174 .CodeMirror-vscrollbar {
175 right: 0; top: 0;
176 overflow-x: hidden;
177 overflow-y: scroll;
178 }
179 .CodeMirror-hscrollbar {
180 bottom: 0; left: 0;
181 overflow-y: hidden;
182 overflow-x: scroll;
183 }
184 .CodeMirror-scrollbar-filler {
185 right: 0; bottom: 0;
186 }
187 .CodeMirror-gutter-filler {
188 left: 0; bottom: 0;
189 }
190
191 .CodeMirror-gutters {
192 position: absolute; left: 0; top: 0;
193 padding-bottom: 30px;
194 z-index: 3;
195 }
196 .CodeMirror-gutter {
197 white-space: normal;
198 height: 100%;
199 -moz-box-sizing: content-box;
200 box-sizing: content-box;
201 padding-bottom: 30px;
202 margin-bottom: -32px;
203 display: inline-block;
204 /* Hack to make IE7 behave */
205 *zoom:1;
206 *display:inline;
207 }
208 .CodeMirror-gutter-elt {
209 position: absolute;
210 cursor: default;
211 z-index: 4;
212 }
213
214 .CodeMirror-lines {
215 cursor: text;
216 }
217 .CodeMirror pre {
218 /* Reset some styles that the rest of the page might have set */
219 -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
220 border-width: 0;
221 background: transparent;
222 font-family: inherit;
223 font-size: inherit;
224 margin: 0;
225 white-space: pre;
226 word-wrap: normal;
227 line-height: inherit;
228 color: inherit;
229 z-index: 2;
230 position: relative;
231 overflow: visible;
232 }
233 .CodeMirror-wrap pre {
234 word-wrap: break-word;
235 white-space: pre-wrap;
236 word-break: normal;
237 }
238
239 .CodeMirror-linebackground {
240 position: absolute;
241 left: 0; right: 0; top: 0; bottom: 0;
242 z-index: 0;
243 }
244
245 .CodeMirror-linewidget {
246 position: relative;
247 z-index: 2;
248 overflow: auto;
249 }
250
251 .CodeMirror-widget {}
252
253 .CodeMirror-wrap .CodeMirror-scroll {
254 overflow-x: hidden;
255 }
256
257 .CodeMirror-measure {
258 position: absolute;
259 width: 100%;
260 height: 0;
261 overflow: hidden;
262 visibility: hidden;
263 }
264 .CodeMirror-measure pre { position: static; }
265
266 .CodeMirror div.CodeMirror-cursor {
267 position: absolute;
268 border-right: none;
269 width: 0;
270 }
271
272 div.CodeMirror-cursors {
273 visibility: hidden;
274 position: relative;
275 z-index: 1;
276 }
277 .CodeMirror-focused div.CodeMirror-cursors {
278 visibility: visible;
279 }
280
281 .CodeMirror-selected { background: #d9d9d9; }
282 .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
283 .CodeMirror-crosshair { cursor: crosshair; }
284
285 .cm-searching {
286 background: #ffa;
287 background: rgba(255, 255, 0, .4);
288 }
289
290 /* IE7 hack to prevent it from returning funny offsetTops on the spans */
291 .CodeMirror span { *vertical-align: text-bottom; }
292
293 /* Used to force a border model for a node */
294 .cm-force-border { padding-right: .1px; }
295
296 @media print {
297 /* Hide the cursor when printing */
298 .CodeMirror div.CodeMirror-cursors {
299 visibility: hidden;
300 }
301 }
This diff could not be displayed because it is too large.
1 /*
2 ColorBox Core Style:
3 The following CSS is consistent between example themes and should not be altered.
4 */
5 #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999;}
6 #cboxOverlay{position:fixed; width:100%; height:100%;}
7 #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8 #cboxContent{position:relative;}
9 #cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
10 #cboxTitle{margin:0;}
11 #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
12 #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13 .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
14 .cboxIframe{width:100%; height:100%; display:block; border:0;}
15 #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
16
17 /*
18 User Style:
19 Change the following styles to modify the appearance of ColorBox. They are
20 ordered & tabbed in a way that represents the nesting of the generated HTML.
21 */
22 #cboxOverlay{background:#222;}
23 #colorbox{outline:0;}
24
25 #cboxContent{background:#fff; padding: 10px;}
26 .cboxIframe{background:#fff;}
27 #cboxError{padding:50px; border:1px solid #ccc;}
28 #cboxLoadedContent{margin-bottom:28px;}
29 #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
30 #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
31 #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;}
32 #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
33
34 /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
35 #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
36
37 /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
38 #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
39
40 #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
41 #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
42 #cboxPrevious:hover{background-position:-75px -25px;}
43 #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
44 #cboxNext:hover{background-position:-50px -25px;}
45 #cboxClose{position:absolute; top:12px; right:6px; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
46 #cboxClose:hover{background-position:-25px -25px;}
47
48 /*
49 The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
50 when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
51 See: http://jacklmoore.com/notes/ie-transparency-problems/
52 */
53 .cboxIE #cboxTopLeft,
54 .cboxIE #cboxTopCenter,
55 .cboxIE #cboxTopRight,
56 .cboxIE #cboxBottomLeft,
57 .cboxIE #cboxBottomCenter,
58 .cboxIE #cboxBottomRight,
59 .cboxIE #cboxMiddleLeft,
60 .cboxIE #cboxMiddleRight {
61 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
62 }
63
64 /*
65 The following provides PNG transparency support for IE6
66 Feel free to remove this and the /ie6/ directory if you have dropped IE6 support.
67 */
68 .cboxIE6 #cboxTopLeft{background:url(images/ie6/borderTopLeft.png);}
69 .cboxIE6 #cboxTopCenter{background:url(images/ie6/borderTopCenter.png);}
70 .cboxIE6 #cboxTopRight{background:url(images/ie6/borderTopRight.png);}
71 .cboxIE6 #cboxBottomLeft{background:url(images/ie6/borderBottomLeft.png);}
72 .cboxIE6 #cboxBottomCenter{background:url(images/ie6/borderBottomCenter.png);}
73 .cboxIE6 #cboxBottomRight{background:url(images/ie6/borderBottomRight.png);}
74 .cboxIE6 #cboxMiddleLeft{background:url(images/ie6/borderMiddleLeft.png);}
75 .cboxIE6 #cboxMiddleRight{background:url(images/ie6/borderMiddleRight.png);}
76
77 .cboxIE6 #cboxTopLeft,
78 .cboxIE6 #cboxTopCenter,
79 .cboxIE6 #cboxTopRight,
80 .cboxIE6 #cboxBottomLeft,
81 .cboxIE6 #cboxBottomCenter,
82 .cboxIE6 #cboxBottomRight,
83 .cboxIE6 #cboxMiddleLeft,
84 .cboxIE6 #cboxMiddleRight {
85 _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
86 }
1 /*jslint browser: true, white: true */
2 /*global console,jQuery,megamenu,window,navigator*/
3
4 /**
5 * Max Mega Menu jQuery Plugin
6 */
7 jQuery(function($) {
8
9 // Make block areas sortable
10 $( ".mega-blocks .mega-left" ).sortable({
11 forcePlaceholderSize: false,
12 items : '.block',
13 stop: function() {
14 reindex_blocks();
15 },
16 connectWith: ".mega-blocks .mega-right, .mega-blocks .mega-center"
17 });
18
19 $( ".mega-blocks .mega-right" ).sortable({
20 forcePlaceholderSize: false,
21 items : '.block',
22 stop: function() {
23 reindex_blocks();
24 },
25 connectWith: ".mega-blocks .mega-left, .mega-blocks .mega-center"
26 });
27
28 $( ".mega-blocks .mega-center" ).sortable({
29 forcePlaceholderSize: false,
30 items : '.block',
31 stop: function() {
32 reindex_blocks();
33 },
34 connectWith: ".mega-blocks .mega-left, .mega-blocks .mega-right"
35 });
36
37
38 // Reindex blocks based on position
39 var reindex_blocks = function() {
40 var i = 0;
41
42 $(".mega-blocks .block").each(function() {
43 i++;
44
45 var block = $(this);
46
47 block.find('input, select, textarea').each(function() {
48 // account for inputs created by select2
49 if (typeof $(this).attr('name') !== 'undefined') {
50 $(this).attr('name', $(this).attr('name').replace(/\[\d+\]/g, "[" + i + "]"));
51 }
52 });
53
54 // update the align value based on block position
55 block.find('input.align').each(function() {
56 if (block.parent().hasClass('mega-right')) {
57 $(this).attr('value', 'right');
58 } else if (block.parent().hasClass('mega-center')) {
59 $(this).attr('value', 'center');
60 } else {
61 $(this).attr('value', 'left');
62 }
63 });
64 });
65 };
66
67
68 // Delete block
69 $( ".mega-toggle_blocks").on('click', 'a.mega-delete', function(e) {
70 e.preventDefault();
71 $(this).parent(".block-settings").parent(".block").remove();
72 reindex_blocks();
73 });
74
75
76 // Show/hide block settings
77 $( '.mega-toggle_blocks').on('click', '.block-title', function(e) {
78 e.preventDefault();
79 e.stopPropagation();
80
81 var settings = $(this).parent().find(".block-settings");
82 $(".block").removeClass('mega-open');
83
84 if ( settings.is(":visible") ) {
85 settings.parent().removeClass('mega-open');
86 settings.hide();
87 } else {
88 settings.parent().addClass('mega-open');
89 $(".block-settings").hide();
90 settings.show();
91 }
92
93 });
94
95
96 // Add block to designer
97 $( "#toggle-block-selector").on('change', function() {
98 var selected_option = $("#toggle-block-selector").find(":selected");
99 var val = selected_option.attr('value');
100
101 if (val == 'title') {
102 return;
103 }
104
105 $.ajax({
106 type: 'POST',
107 url: ajaxurl,
108 data: {
109 action: "mm_get_toggle_block_" + val,
110 _wpnonce: megamenu.nonce
111 },
112 cache: false,
113 success: function(response) {
114
115 var $response = $(response);
116
117 // initiate color picker fields
118 $(".mm_colorpicker", $response).spectrum({
119 preferredFormat: "rgb",
120 showInput: true,
121 showAlpha: true,
122 clickoutFiresChange: true,
123 change: function(color) {
124 if (color.getAlpha() === 0) {
125 $(this).siblings('div.chosen-color').html('transparent');
126 } else {
127 $(this).siblings('div.chosen-color').html(color.toRgbString());
128 }
129 }
130 });
131
132 // initiate icon selector dropdowns
133 $('.icon_dropdown', $response).select2({
134 containerCssClass: 'tpx-select2-container select2-container-sm',
135 dropdownCssClass: 'tpx-select2-drop',
136 minimumResultsForSearch: -1,
137 formatResult: function(icon) {
138 return '<i class="dashicons ' + $(icon.element).attr('data-class') + '"></i>';
139 },
140 formatSelection: function (icon) {
141 return '<i class="dashicons ' + $(icon.element).attr('data-class') + '"></i>';
142 }
143 });
144
145 // add the block
146 $(".mega-blocks .mega-left").append($response);
147
148 // reinded blocks
149 reindex_blocks();
150
151 // reset the select dropdown
152 $("#toggle-block-selector").val("title");
153
154 $('body').trigger('toggle_block_content_loaded');
155
156 }
157 });
158 });
159 });
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 <?php
2 /**
3 * Template Name: Full Width Page
4 *
5 * Template for displaying a page without sidebar even if a sidebar widget is published.
6 *
7 * @package Understrap
8 */
9
10 // Exit if accessed directly.
11
12 defined( 'ABSPATH' ) || exit;
13
14 $subhead = get_field('subhead');
15 $thumb_id = get_post_thumbnail_id();
16 $first_cap = get_field('caption');
17 $first_copy = get_field('copyright');
18
19 get_header();
20 $container = get_theme_mod( 'understrap_container_type' );
21
22 if ( is_front_page() ) {
23 get_template_part( 'global-templates/hero' );
24 }
25
26 ?>
27
28
29 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
30
31 <?php if ( has_post_thumbnail() ) { ?>
32 <div class='cap-wrap home-header'>
33 <?php echo get_the_post_thumbnail( $post->ID, 'full' ); ?>
34 <div class="content-container">
35 <div class="container" style="height: 100%;">
36 <div class="col-md-12 fx-style">
37 <div class="search-box"><?php the_field('search_box_content'); ?></div>
38 <h1><?php the_field('header_text'); ?></h1>
39 </div>
40 </div>
41 </div>
42 <div class='side-caption header-caption <?= (empty($first_copy) && empty($first_cap)) ? "hide" : "" ?>'>
43 <a class='copy-link' aria-label="Header Slide Caption" href='#' ></a>
44 <span class='image-side-caption'>
45 <span class='cap'><?= $first_cap ?></span>
46 <span class='copyright'><?= ($first_copy) ? "&copy; ".$first_copy : "" ?></span>
47 </span>
48 </div>
49
50 </div>
51
52 <?php } ?>
53
54
55
56
57 <div class="wrapper" id="full-width-page-wrapper">
58
59 <div class="<?php echo esc_attr( $container ); ?>" id="content">
60
61 <div class="col-md-12 content-area" id="primary">
62
63 <main class="site-main" id="main" role="main">
64
65 <?php
66 while ( have_posts() ) {
67 the_post();
68 get_template_part( 'loop-templates/content', 'front' );
69
70 }
71 ?>
72
73 </main><!-- #main -->
74
75 </div><!-- #primary -->
76
77 </div><!-- #content -->
78
79 </div><!-- #full-width-page-wrapper -->
80
81 <?php
82 get_footer();
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
8 // Exit if accessed directly. 8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit; 9 defined( 'ABSPATH' ) || exit;
10 10
11 @ini_set( 'upload_max_size' , '100M' ); 11 @ini_set( 'upload_max_size' , '256M' );
12 @ini_set( 'post_max_size', '256M');
13 @ini_set( 'max_execution_time', '300' );
12 14
13 15
14 require_once __DIR__.'/vendor/autoload.php'; 16 require_once __DIR__.'/vendor/autoload.php';
...@@ -90,3 +92,15 @@ function understrap_child_customize_controls_js() { ...@@ -90,3 +92,15 @@ function understrap_child_customize_controls_js() {
90 ); 92 );
91 } 93 }
92 add_action( 'customize_controls_enqueue_scripts', 'understrap_child_customize_controls_js' ); 94 add_action( 'customize_controls_enqueue_scripts', 'understrap_child_customize_controls_js' );
95
96
97 function megamenu_override_default_theme($value) {
98 // change 'primary' to your menu location ID
99 if ( !isset($value['primary']['theme']) ) {
100 $value['primary']['theme'] = 'msf'; // change my_custom_theme_key to the ID of your exported theme
101 }
102
103 return $value;
104 }
105 add_filter('default_option_megamenu_settings', 'megamenu_override_default_theme');
106
...\ No newline at end of file ...\ No newline at end of file
......
1 <?php
2 /**
3 * Hero setup
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10
11 if ( is_active_sidebar( 'hero' ) || is_active_sidebar( 'statichero' ) || is_active_sidebar( 'herocanvas' ) ) :
12 ?>
13
14 <div class="wrapper" id="wrapper-hero">
15
16 <?php
17 get_template_part( 'sidebar-templates/sidebar', 'hero' );
18 get_template_part( 'sidebar-templates/sidebar', 'herocanvas' );
19 get_template_part( 'sidebar-templates/sidebar', 'statichero' );
20 ?>
21
22 </div>
23
24 <?php
25 endif;
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
4 * Licensed under GPL-3.0 (undefined) 4 * Licensed under GPL-3.0 (undefined)
5 */ 5 */
6 (function (global, factory) { 6 (function (global, factory) {
7 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 7 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) :
8 typeof define === 'function' && define.amd ? define(['exports'], factory) : 8 typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) :
9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.understrap = {})); 9 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.understrap = {}, global.jQuery));
10 })(this, (function (exports) { 'use strict'; 10 })(this, (function (exports, jquery) { 'use strict';
11 11
12 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 12 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13 13
...@@ -6743,104 +6743,145 @@ ...@@ -6743,104 +6743,145 @@
6743 } 6743 }
6744 })(); 6744 })();
6745 6745
6746 // Add your custom JS here. 6746 var Responsive = function ($) {
6747 6747 // $('.play-pause-btn').on('click', function() {
6748 //In order to do that we have to flex:1 each item.. see flexMatrix 6748 // if(!this.isDesktop()) {
6749 function correctDropdownMenuItemGaps() { 6749 // $(this).hide();
6750 var drop_index = 0; 6750 // $(this).parents('.swiper-wrapper').find('.header-video').trigger('play');
6751 jQuery('#main-menu > li').each(function () { 6751 // }
6752 var dropdown = jQuery(this).find('.dropdown-menu'); 6752 // });
6753 consecutive_normals = 0; 6753
6754 if (dropdown.length > 0) { 6754 var desk = window.matchMedia("(min-width: 1150px)");
6755 var items = jQuery(dropdown).find('li'), 6755 function isDesktop() {
6756 idx = 0, 6756 return desk.matches;
6757 total_width = 0; 6757 }
6758 items.each(function (item) { 6758 function toggleMobileMenu() {
6759 ++idx; 6759 $('#navbarNavDropdown').toggleClass('show');
6760 if (flexMatrix(items, idx)) { 6760 $('.navbar-toggler').toggleClass('active');
6761 items.eq(idx - 1).css('flex', 1); 6761 if ($('#navbarNavDropdown').hasClass('show')) {
6762 total_width += items.eq(idx - 1).width(); 6762 $('body').addClass('locked');
6763 // if(drop_idx == 2) { 6763 } else {
6764 // console.log(total_width) 6764 $('body').removeClass('locked');
6765 // } 6765 }
6766 } 6766 }
6767 $(document).on('click', '.navbar-toggler', function () {
6768 toggleMobileMenu();
6769 });
6770 $.fn.classChange = function (cb) {
6771 return $(this).each((_, el) => {
6772 new MutationObserver(mutations => {
6773 mutations.forEach(mutation => cb && cb(mutation.target, $(mutation.target).prop(mutation.attributeName)));
6774 }).observe(el, {
6775 attributes: true,
6776 attributeFilter: ['class'] // only listen for class attribute changes
6767 }); 6777 });
6778 });
6779 };
6768 6780
6769 if (drop_index >= 3) { 6781 function init() {
6770 jQuery(this).find('.dropdown-shadow').css('width', total_width); 6782 $('body').classChange(function (el, new_class) {
6771 } else { 6783 if (new_class.indexOf('pojo-a11y-resize-font-130') !== -1) {
6772 jQuery(this).find('.dropdown-shadow').css('width', total_width); 6784 setTimeout(function () {
6785 $(window).trigger('resize');
6786 }, 500);
6773 } 6787 }
6788 });
6789 function putBackMenuItemsToLastIndex() {
6790 $('.mi-image-container').each(function () {
6791 var item = $(this).parentsUntil('.menu-item');
6792 var last_idx = $(item).data('last-idx');
6793 var cur_idx = $(item).index();
6794 console.log(last_idx + " " + cur_idx);
6795 if (last_idx != cur_idx) {
6796 var item = $(this).parents('.menu-item')[0];
6797 var dropdown = $(this).parents('.dropdown-menu');
6798 $(dropdown).children().eq(last_idx).before(item);
6799 }
6800 });
6774 } 6801 }
6775 ++drop_index; 6802 function makeImageMenuItemsLastItems() {
6776 }); 6803 $('.mi-image-container').each(function () {
6777 } 6804 var item = $(this).parents('.menu-item')[0];
6778 var consecutive_normals = 0; 6805 if (last_idx != 1) {
6779 6806 var dropdown = $(this).parents('.dropdown-menu');
6780 //Returns true if this menu item should flex:1, it's true if an image is the next item and this item is not a 3rd.. etc. 6807 var last_idx = $(dropdown).find('li').index(item);
6781 function flexMatrix(items, current_idx) { 6808 $(item).data('last-idx', last_idx);
6782 var last_item = items.eq(current_idx - 2); 6809 $(dropdown).append(item);
6783 var next_item = items.eq(current_idx); 6810 }
6784 var item = items.eq(current_idx - 1); 6811 });
6785
6786 //if the last item was an image we started a new col so do not break here unless its the last one
6787 if (last_item) {
6788 if (jQuery(last_item).find('img').length > 0 && !next_item) {
6789 return false;
6790 } 6812 }
6791 } 6813 function setupDropdownMenuHeights() {
6792 6814 $('.dropdown-menu').each(function () {
6793 //if the next item is an image item or this is the last one 6815 $(this).css('height', $(this).height() + 5);
6794 if (next_item) { 6816 $(this).addClass('ready');
6795 if (jQuery(next_item).find('img').length > 0) { 6817 });
6796 consecutive_normals = 0;
6797 return true;
6798 } 6818 }
6799 } 6819 function makeMobileCarousels() {
6800 //last item flex it 6820 LegacyCalc.mobilize();
6801 if (items.length === current_idx) { 6821 ImageCollage.mobilize();
6802 return true; 6822 }
6803 } 6823 function demobilize() {
6804 if (jQuery(item).hasClass('break-here')) { 6824 $('.donate.menu-item').append($('#main-nav .donate-btn'));
6805 consecutive_normals = 0; 6825 $('.navbar-toggler').after($('#navbarNavDropdown'));
6806 return true; 6826 $('.news-and-stories-block').each(function () {
6807 } 6827 var btn = $(this).find('.post-list-load-more');
6808 6828 $(this).append(btn);
6809 //If this is an image item flex 6829 });
6810 if (jQuery(item).find('img').length > 0) { 6830 // HeaderMenu.alignTheSideCaptions();
6811 consecutive_normals = 0; 6831 putBackMenuItemsToLastIndex();
6812 return true; 6832 // demobilizeJobIframes();
6813 }
6814 ++consecutive_normals;
6815 //If this is a 3rd consecutive normal item
6816 if (consecutive_normals == 3) {
6817 consecutive_normals = 0;
6818 return true;
6819 }
6820 }
6821
6822 //This adjusts the menu dropdown location to never go past the inner edge of the Donate Now button
6823 //and line up with it if so
6824 function lineUpThePositionsOfTheDropdowns() {
6825 var menu_item_widths = [];
6826 jQuery('#main-menu > li').each(function () {
6827 menu_item_widths.push(jQuery(this).outerWidth());
6828 });
6829 6833
6830 //Remove the donate button 6834 if ($('.menu-item-11505').length > 0) {
6831 menu_item_widths.pop(); 6835 $('.menu-item-11503').parents('.dropdown-menu').find('li:last-of-type').before($('.menu-item-11503'));
6832 var idx = 0; 6836 $('.menu-item-11505').parents('.dropdown-menu').find('li:last-of-type').before($('.menu-item-11505'));
6833 jQuery('#main-menu > li').each(function () { 6837 }
6834 if (jQuery(this).find('.dropdown-menu').length > 0) { 6838 if ($('.menu-item-15438').length > 0) {
6835 if (idx == 0) { 6839 $('.menu-item-15438').parents('.dropdown-menu').find('li:last-of-type').before($('.menu-item-15438'));
6836 jQuery(this).find('.dropdown-menu').css('left', -100); 6840 $('.menu-item-15442').parents('.dropdown-menu').find('li:last-of-type').before($('.menu-item-15442'));
6841 }
6842 }
6843 function mobilize() {
6844 var donate_btn = $('#main-menu .donate > a');
6845 if (!$(donate_btn).hasClass('donate-btn')) {
6846 $(donate_btn).addClass('donate-btn');
6847 }
6848 $('#main-nav .container').append(donate_btn);
6849 $('#wrapper-navbar').append($('#navbarNavDropdown'));
6850 $('.news-and-stories-block').each(function () {
6851 var btn = $(this).find('.post-list-load-more');
6852 $(this).prepend(btn);
6853 });
6854 // HeaderMenu.alignTheSideCaptions();
6855 makeMobileCarousels();
6856 makeImageMenuItemsLastItems();
6857 setupDropdownMenuHeights();
6858 if ($('.menu-item-11505').length > 0) {
6859 $('.menu-item-11505').parents('.dropdown-menu').prepend($('.menu-item-11505'));
6860 $('.menu-item-11503').parents('.dropdown-menu').prepend($('.menu-item-11503'));
6861 }
6862 if ($('.menu-item-15438').length > 0) {
6863 $('.menu-item-15442').parents('.dropdown-menu').prepend($('.menu-item-15442'));
6864 $('.menu-item-15438').parents('.dropdown-menu').prepend($('.menu-item-15438'));
6865 }
6866 }
6867 desk.addEventListener('change', event => {
6868 if (event.matches) {
6869 demobilize();
6837 } else { 6870 } else {
6838 jQuery(this).find('.dropdown-menu').css('right', -100); 6871 mobilize();
6839 } 6872 }
6873 });
6874 if (desk.matches) ; else {
6875 mobilize();
6840 } 6876 }
6841 ++idx; 6877 }
6842 }); 6878 return {
6843 } 6879 init: init,
6880 isDesktop: isDesktop
6881 };
6882 }(jquery);
6883 jquery(document).ready(Responsive.init);
6884
6844 var HeaderMenu = function () { 6885 var HeaderMenu = function () {
6845 return { 6886 return {
6846 alignTheSideCaptions: function () { 6887 alignTheSideCaptions: function () {
...@@ -6872,32 +6913,12 @@ ...@@ -6872,32 +6913,12 @@
6872 }; 6913 };
6873 }(); 6914 }();
6874 jQuery(function ($) { 6915 jQuery(function ($) {
6875 correctDropdownMenuItemGaps();
6876 lineUpThePositionsOfTheDropdowns();
6877 setInterval(function () { 6916 setInterval(function () {
6878 HeaderMenu.alignTheSideCaptions(); 6917 HeaderMenu.alignTheSideCaptions();
6879 }, 1000); 6918 }, 1000);
6880 $('.copy-link').on('click', function (e) { 6919 $('.copy-link').on('click', function (e) {
6881 e.preventDefault(); 6920 e.preventDefault();
6882 }); 6921 });
6883 var body = document.getElementsByTagName("BODY")[0];
6884 body.offsetWidth;
6885 if (window.addEventListener) {
6886 // all browsers except IE before version 9
6887 window.addEventListener("resize", onResizeEvent, true);
6888 } else {
6889 if (window.attachEvent) {
6890 // IE before version 9
6891 window.attachEvent("onresize", onResizeEvent);
6892 }
6893 }
6894 function onResizeEvent() {
6895 // bodyElement = document.getElementsByTagName("BODY")[0];
6896 // newWidth = bodyElement.offsetWidth;
6897 // if(newWidth != width){
6898 // width = newWidth;
6899 // }
6900 }
6901 }); 6922 });
6902 6923
6903 exports.Alert = alert; 6924 exports.Alert = alert;
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 <?php
2 /**
3 * Template for displaying posts on the author archive
4 *
5 * @package Understrap
6 * @since 1.0.0
7 */
8
9 // Exit if accessed directly.
10 defined( 'ABSPATH' ) || exit;
11 ?>
12
13 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
14
15 <header class="entry-header">
16
17 <?php
18 the_title(
19 sprintf( '<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ),
20 '</a></h3>'
21 );
22 ?>
23
24 <?php if ( 'post' === get_post_type() ) : ?>
25
26 <div class="entry-meta">
27
28 <?php understrap_posted_on(); ?>
29
30 </div><!-- .entry-meta -->
31
32 <?php endif; ?>
33
34 </header><!-- .entry-header -->
35
36 <div class="entry-summary">
37
38 <?php the_excerpt(); ?>
39
40 </div><!-- .entry-summary -->
41
42 <footer class="entry-footer">
43
44 <?php understrap_entry_footer(); ?>
45
46 </footer><!-- .entry-footer -->
47
48 </article><!-- #post-<?php the_ID(); ?> -->
1 <?php
2 /**
3 * Blank content partial template
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10
11 the_content();
1 <?php
2 /**
3 * Content empty partial template
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10
11 the_content();
1 <?php
2 /**
3 * Partial template for content in page.php
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10
11
12 ?>
13
14 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
15
16
17
18 <div class="entry-content">
19
20 <?php
21 the_content();
22 understrap_link_pages();
23 ?>
24
25 </div><!-- .entry-content -->
26
27 <footer class="entry-footer">
28
29 <?php understrap_edit_post_link(); ?>
30
31 </footer><!-- .entry-footer -->
32
33 </article><!-- #post-## -->
1 <?php
2 /**
3 * The template part for displaying a message that posts cannot be found
4 *
5 * Learn more: https://developer.wordpress.org/themes/basics/template-hierarchy/
6 *
7 * @package Understrap
8 */
9
10 // Exit if accessed directly.
11 defined( 'ABSPATH' ) || exit;
12 ?>
13
14 <section class="no-results not-found">
15
16 <header class="page-header">
17
18 <h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'understrap' ); ?></h1>
19
20 </header><!-- .page-header -->
21
22 <div class="page-content">
23
24 <?php
25 if ( is_home() && current_user_can( 'publish_posts' ) ) :
26
27 $kses = array( 'a' => array( 'href' => array() ) );
28 printf(
29 /* translators: 1: Link to WP admin new post page. */
30 '<p>' . wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'understrap' ), $kses ) . '</p>',
31 esc_url( admin_url( 'post-new.php' ) )
32 );
33
34 elseif ( is_search() ) :
35
36 printf(
37 '<p>%s<p>',
38 esc_html__( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'understrap' )
39 );
40 get_search_form();
41
42 else :
43
44 printf(
45 '<p>%s<p>',
46 esc_html__( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'understrap' )
47 );
48 get_search_form();
49
50 endif;
51 ?>
52 </div><!-- .page-content -->
53
54 </section><!-- .no-results -->
...@@ -8,59 +8,21 @@ ...@@ -8,59 +8,21 @@
8 // Exit if accessed directly. 8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit; 9 defined( 'ABSPATH' ) || exit;
10 10
11 $slides = [];
12 $featured_image = null;
13
14 if(function_exists( 'get_field')) {
15
16 $slides = get_field('header_slides', get_the_ID());
17 $featured_image = get_the_post_thumbnail_url( get_the_ID(), 'large' );
18 if(!$featured_image) {
19 $featured_image = get_field('photo_from_source', get_the_ID());
20 }
21
22 }
23 ?> 11 ?>
24 12
25 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>"> 13 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
26 14
27 <?php
28 if (empty($slides) && (!$featured_image || is_page_template("page-templates/h1belowphoto.php") || has_term('job-profile','page_type') || has_term('job-profile-fr','page_type') || is_page_template("page-templates/campaign-landing.php") ) ) {?>
29 <header class="entry-header home <?= (!has_term('job-profile','page_type'))?'no-photo':'' ?>">
30 <?php } else { ?>
31 <header class="entry-header home">
32 <?php } ?>
33 <?php
34 get_template_part("template-parts/header");
35 ?>
36 15
37 </header><!-- .entry-header -->
38 16
39 <?php if(is_front_page()) { ?> 17 <header class="entry-header home">
40 <div class='content-header-seperater'></div>
41 <?php } ?>
42 18
43 <div class="entry-content <?= (has_term('job-profile','page_type'))?'job-profile':'' ?>">
44 19
45 <?php 20 </header><!-- .entry-header -->
21 <div class='content-header-seperater'></div>
46 22
47 23
48 if (empty($slides) && (!$featured_image || is_page_template("page-templates/h1belowphoto.php") || has_term('job-profile','page_type') || has_term('job-profile-fr','page_type') || is_page_template("page-templates/campaign-landing.php") ) ) { ?> 24
49 <div class='no-header-photo'> 25 <div class="entry-content">
50 <div class="breadcrumb"><?php get_breadcrumb(); ?></div>
51 <?php the_title( '<h1 class="entry-title">', '</h1>' );
52 $h2 = get_post_meta($post->ID, 'subhead', true);
53 if(!empty($h2)) {
54 ?>
55 <h2 class="subhead"><?= $h2 ?></h2>
56 <?php } ?>
57 </div>
58 <?php }
59 ?>
60
61 <?php if(has_term('urgent-job','page_type',get_the_ID()) || has_term('urgent-job-fr','page_type',get_the_ID()) ) { ?>
62 <span class='urgent-header'><?= __('URGENT', 'msf') ?></span>
63 <?php } ?>
64 26
65 <?php 27 <?php
66 the_content(); 28 the_content();
......
1 <?php
2 /**
3 * Search results partial template
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10 ?>
11
12 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
13
14 <header class="entry-header">
15
16 <?php
17 the_title(
18 sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ),
19 '</a></h2>'
20 );
21 ?>
22
23 <?php if ( 'post' === get_post_type() ) : ?>
24
25 <div class="entry-meta">
26
27 <?php understrap_posted_on(); ?>
28
29 </div><!-- .entry-meta -->
30
31 <?php endif; ?>
32
33 </header><!-- .entry-header -->
34
35 <div class="entry-summary">
36
37 <?php the_excerpt(); ?>
38
39 </div><!-- .entry-summary -->
40
41 <footer class="entry-footer">
42
43 <?php understrap_entry_footer(); ?>
44
45 </footer><!-- .entry-footer -->
46
47 </article><!-- #post-<?php the_ID(); ?> -->
1 <?php
2 /**
3 * Single post partial template
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10 ?>
11
12 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
13
14 <header class="entry-header">
15
16 <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
17
18 <div class="entry-meta">
19
20 <?php understrap_posted_on(); ?>
21
22 </div><!-- .entry-meta -->
23
24 </header><!-- .entry-header -->
25
26 <?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>
27
28 <div class="entry-content">
29
30 <?php
31 the_content();
32 understrap_link_pages();
33 ?>
34
35 </div><!-- .entry-content -->
36
37 <footer class="entry-footer">
38
39 <?php understrap_entry_footer(); ?>
40
41 </footer><!-- .entry-footer -->
42
43 </article><!-- #post-<?php the_ID(); ?> -->
1 <?php
2 /**
3 * Post rendering content according to caller of get_template_part
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10 ?>
11
12 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
13
14 <header class="entry-header">
15
16 <?php
17 the_title(
18 sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ),
19 '</a></h2>'
20 );
21 ?>
22
23 <?php if ( 'post' === get_post_type() ) : ?>
24
25 <div class="entry-meta">
26 <?php understrap_posted_on(); ?>
27 </div><!-- .entry-meta -->
28
29 <?php endif; ?>
30
31 </header><!-- .entry-header -->
32
33 <?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>
34
35 <div class="entry-content">
36
37 <?php
38 the_excerpt();
39 understrap_link_pages();
40 ?>
41
42 </div><!-- .entry-content -->
43
44 <footer class="entry-footer">
45
46 <?php understrap_entry_footer(); ?>
47
48 </footer><!-- .entry-footer -->
49
50 </article><!-- #post-<?php the_ID(); ?> -->
1 <?php
2 /**
3 * Sidebar setup for footer full
4 *
5 * @package Understrap
6 */
7
8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit;
10
11 $container = get_theme_mod( 'understrap_container_type' );
12
13 ?>
14
15 <?php if ( is_active_sidebar( 'footerfull' ) ) : ?>
16
17 <!-- ******************* The Footer Full-width Widget Area ******************* -->
18
19 <div class="wrapper" id="wrapper-footer-full" role="complementary">
20
21 <div class="<?php echo esc_attr( $container ); ?>" id="footer-full-content" tabindex="-1">
22
23 <div class="row">
24
25 <?php dynamic_sidebar( 'footerfull' ); ?>
26
27 </div>
28
29 </div>
30
31 </div><!-- #wrapper-footer-full -->
32
33 <?php
34 endif;