multiple css classes
-
Could you add support for multiple css classes? This would be super handy for mimicking the styling of other menus in my theme without adding more css to the page. Thanks!
Viewing 6 replies - 1 through 6 (of 6 total)
-
Thanks for the suggestion.
Also, I think it’s a good idea.
This would make this plugin way handier!
As it stands thanks though.
Thanks for the suggestion. I’m planning to add multiple css class to the next release.
You could add the ability for multiple classes reasonably simply. I’ve just added the following code to the update method in the widget class if it helps anyone.
public function update( $new_instance, $old_instance ) { $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['nav_menu'] = (int) $new_instance['nav_menu']; $instance['title_url'] = esc_html( $new_instance['title_url'] ); /* * Multiple classes fix */ $output = ''; $classes = explode(" ", $new_instance['menu_class']); foreach($classes as $class) { $output .= sanitize_html_class($class) . ' '; } $output = rtrim($output, ' '); $instance['menu_class'] = $output; return $instance; }Thanks Joe! This works well–I just made a slight modification to strip out multiple spaces. I should have it release within a week.
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘multiple css classes’ is closed to new replies.