Skip to content

Commit

Permalink
* Fix: Shortcode was using echo and is now using returnin…
Browse files Browse the repository at this point in the history
…stead.

* Fix: Position of inner wrapper changed to relative to contain dropdown menu
* Update: ```#sagaio-udm-menu-wrapper``` changed name to ```#sagaio-udm-menu-inner-wrapper```.
* New: Added outer wrapper and options for configuring its position, id: ```#sagaio-udm-menu-wrapper``.
  • Loading branch information
flaird committed Nov 17, 2016
1 parent e44c493 commit 4f6088a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 11 deletions.
3 changes: 3 additions & 0 deletions css/user-dropdown-menu.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#sagaio-udm-inner-wrapper {
position: relative !important;
}
div.sagaio-udm-icon:hover {
cursor: pointer;
}
Expand Down
28 changes: 26 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ Licemse URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html

Insert a dropdown menu with a icon button, based on Bootstrap 4.0 Dropdown. All settings can be found in the Theme Customizer.

= Features =

* Build your menu from the standard interface and assign it to User Dropdown Menu
* All settings found in your Theme Customizer
* Option to change the default icon image
* Option to display login form that is customizable
* Option to display header above login form
* Option to display current username in menu
* Option to display header above username
* Option to display logout link
* Lots of more options when it comes to styling

Are you missing an option? Head over to https://github.com/sagaio/user-dropdown-menu and submit an issue.

== Installation ==

= From your WordPress dashboard =
Expand Down Expand Up @@ -49,11 +63,21 @@ Start a topic in the support section

== Changelog ==

= 1.0.2 =
*2016-11-17*

* Fix: Shortcode was using ```echo``` and is now using ```return``` instead.
* Fix: Position of inner wrapper changed to relative to contain dropdown menu-
* Update: ```#sagaio-udm-menu-wrapper``` changed name to ```#sagaio-udm-menu-inner-wrapper```.
* New: Added outer wrapper and options for configuring its position, id: ```#sagaio-udm-menu-wrapper``.

= 1.0.1 =
*2016-11-14*
* Fix: Typo in ```<div class="sagaio-udm-menu-header">```
* New: Options for configuring the login header, class: ```.sagaio-udm-menu-header``

* Fix: Typo in ```<div class="sagaio-udm-menu-header">``.
* New: Options for configuring the login header, class: ```.sagaio-udm-menu-header``.

= 1.0.0 =
*2016-11-14*

* First release
36 changes: 27 additions & 9 deletions user-dropdown-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,30 @@ static function sagaio_udm_customize_register( $wp_customize ) {
}

/* Icon: height, widths, margins and paddings */
$general_icon_settings = [];
$icon_hwmp = [];

$general_icon_settings[] = array( 'slug'=>'sagaio_udm_icon_width', 'default' => '30', 'label' => __( 'Icon width', 'sagaio-udm' ) );
$general_icon_settings[] = array( 'slug'=>'sagaio_udm_icon_height', 'default' => '30', 'label' => __( 'Icon height', 'sagaio-udm' ) );
$general_icon_settings[] = array( 'slug'=>'sagaio_udm_icon_margin', 'default' => '0', 'label' => __( 'Icon margin', 'sagaio-udm' ) );
$icon_hwmp[] = array( 'slug'=>'sagaio_udm_icon_width', 'default' => '30', 'label' => __( 'Icon width', 'sagaio-udm' ) );
$icon_hwmp[] = array( 'slug'=>'sagaio_udm_icon_height', 'default' => '30', 'label' => __( 'Icon height', 'sagaio-udm' ) );
$icon_hwmp[] = array( 'slug'=>'sagaio_udm_icon_margin', 'default' => '0', 'label' => __( 'Icon margin', 'sagaio-udm' ) );

foreach($general_icon_settings as $setting)
foreach($icon_hwmp as $setting)
{
$wp_customize->add_setting( $setting['slug'], array( 'default' => $setting['default'], 'type' => 'option', 'capability' => 'edit_theme_options' ));
$wp_customize->add_control( $setting['slug'], array( 'type' => 'number', 'label' => $setting['label'], 'section' => 'sagaio_udm_icon', 'input_attrs' => array( 'min' => 0, 'max' => 100) ));
}

/* Icon: position */
$icon_positions = [];

$icon_positions[] = array( 'slug'=>'sagaio_udm_icon_outer_wrapper_position', 'default' => 'relative', 'label' => __( 'Outer wrapper position', 'sagaio-udm' ) );

foreach($icon_positions as $setting)
{
$wp_customize->add_setting( $setting['slug'], array( 'default' => $setting['default'], 'type' => 'option', 'capability' => 'edit_theme_options' ));
$wp_customize->add_control( $setting['slug'], array( 'type' => 'select', 'label' => $setting['label'], 'section' => 'sagaio_udm_icon', 'choices' => array( 'relative' => 'Relative', 'absolute' => 'Absolute', 'fixed' => 'Fixed', 'static' => 'Static' ) ));
}


/* Login form: border */
$login_form_border[] = array( 'slug'=>'sagaio_udm_login_button_border_width', 'default' => '1', 'label' => __( 'Login button border width', 'sagaio-udm' ) );

Expand Down Expand Up @@ -421,6 +433,9 @@ static function echo_customizer_styles() {
$sagaio_udm_login_header_alignment = get_option('sagaio_udm_login_header_alignment', 'left');
$sagaio_udm_login_button_alignment = get_option('sagaio_udm_login_button_alignment', 'left');

// Outer Wrapper Position
$sagaio_udm_icon_outer_wrapper_position = get_option('sagaio_udm_icon_outer_wrapper_position', 'relative');

// Determine if we whould display labels for the input fields
$display_login_labels = get_option('sagaio_udm_display_login_labels', false);
if(!$display_login_labels) {
Expand All @@ -430,6 +445,9 @@ static function echo_customizer_styles() {
}

$style = '<style>';
$style .= '#sagaio-udm-wrapper {
position: '.$sagaio_udm_icon_outer_wrapper_position.' !important;
}';
$style .= '.sagaio-udm-menu {
background: '.$sagaio_udm_menu_background_color.' !important;
color: '.$sagaio_udm_menu_text_color.' !important;
Expand Down Expand Up @@ -597,7 +615,7 @@ static function handle_shortcode($atts) {

$menu_items = wp_get_nav_menu_items($menu->term_id);

$menu_list = '<div id="sagaio-udm-wrapper"><div class="dropdown sagaio-udm-icon" data-toggle="dropdown"></div>' . "\n";
$menu_list = '<div id="sagaio-udm-wrapper"><div id="sagaio-udm-inner-wrapper"><div class="dropdown sagaio-udm-icon" data-toggle="dropdown"></div>' . "\n";
$menu_list .= '<div class="dropdown-menu sagaio-udm-menu">' . "\n";

// Check if user is logged in
Expand Down Expand Up @@ -676,7 +694,7 @@ static function handle_shortcode($atts) {
);

// important: Restart menu list string concatenation
$menu_list = '<div id="sagaio-udm-wrapper"><div class="dropdown sagaio-udm-icon" data-toggle="dropdown"></div>' . "\n";
$menu_list = '<div id="sagaio-udm-wrapper"><div id="sagaio-udm-inner-wrapper"><div class="dropdown sagaio-udm-icon" data-toggle="dropdown"></div>' . "\n";
$menu_list .= '<div class="dropdown-menu sagaio-udm-menu">' . "\n";
if(get_option('sagaio_udm_display_login_header', true)) {
$header = get_option('sagaio_udm_login_header', 'Login');
Expand All @@ -688,14 +706,14 @@ static function handle_shortcode($atts) {
}

$menu_list .= '</div>' ."\n";
$menu_list .= '</div></div>' ."\n";
$menu_list .= '</div></div></div>' ."\n";

wp_enqueue_style( 'udm-bootstrap-css');
wp_enqueue_style( 'udm-style');
wp_enqueue_script( 'udm-boostrap');

self::echo_customizer_styles();
echo $menu_list;
return $menu_list;

// Optionally echo out scripts for setting the attribute "placeholder" on the login input fields
$placeholder_enabled = get_option('sagaio_udm_display_login_placeholders', true);
Expand Down

0 comments on commit 4f6088a

Please sign in to comment.