What is the best way to show a submenu in a tile menu design like Windows?

Recently, I designed a tiles menu and it is responsive, which means it will support desktop, tablet/iPad, and mobile devices.
But I notice it is very hard to have a submenu in it. Can anyone please provide me some ideas for the best way to show the submenu in a tiles menu like Windows 10?

Here is the layout; the top left tile is the logo.

enter image description here

I have tried a slide menu, but it doesn’t provide me the best solution. Because if I clicked at the bottom left tile, it will be a bit weird when the slide menu slides in from the right edge. The second reason is, there is a big gap: the user has to move their mouse from left to right edge and select the options. Also, because of the big gap issue, it makes the button and the active submenu lose their connection.

enter image description here

add_submenu_page() link missing ‘admin.php?’ prefix

I have two plugins – one is the “primary” plugin called “SmartPost” and I’m trying to extend it with another plugin called “SmartPost E-mails”. So, in other words, “SmartPost E-mails” extends and depends on “SmartPost” to exist and load before the e-mails plugin does.

Within the SmartPost plugin, I have the following admin menu creation functions:

class sp_admin{
   add_action( 'admin_menu', array('sp_admin', 'sp_admin_add_template_page') );
   add_action( 'admin_menu', array('sp_admin', 'sp_admin_add_category_page') );

    function sp_admin_add_template_page() {
        add_menu_page( SP_PLUGIN_NAME, SP_PLUGIN_NAME, 'edit_dashboard', 'smartpost', array('sp_admin', 'sp_template_page'), null, null );
    }

    function sp_admin_add_category_page(){
        add_submenu_page( 'smartpost', 'Settings', 'Settings', 'edit_dashboard', 'sp-cat-page', array('sp_admin', 'sp_settings_page') );
    }
}

In my “SmartPost E-mails” plugin, I want to add a submenu to the SmartPost plugin page, so I have the following code:

class SP_Email_Admin_Page{

    function __construct(){
        add_action( 'admin_menu', array($this, 'sp_add_email_admin_page') );
    }

    function sp_add_email_admin_page(){
        if( ( is_plugin_active( "smartpost-templates/smartpost.php" ) ) && defined( "SP_PLUGIN_NAME" ) ){
            add_submenu_page( 'smartpost', 'E-mail Settings', 'E-mail Settings', 'edit_dashboard', 'sp-email-settings', array($this, 'sp_render_email_admin_page') );
        }
    }

    function sp_render_email_admin_page(){
        ?>
        

Hello World

This results in strange behavior as described in this post. The submenu is added, but is linked improperly (the 'admin.php?' prefix is missing). I think it has to do with the fact that the add_submenu_page is defined outside of the same scope as where the parent menu page was defined - but I'm not sure why that would be a factor. This begs two questions: 1) Why is this happening and 2) how do plugins such as WooCommerce allow 3rd party plugin developers to create sub-menus for the WooCommerce admin page when the add_submenu_page() is most likely defined outside of the same scope as the parent WooCommerce menu page ?

Custom menu – different submenu for first menu item

I created a custom menu with dropdowns. (just CSS no JavaScript).
I also added a custom CSS class for the first menu item.

So far so good.

The point were I get stuck is adding a custom dropdown only for the first menu item which is different from the other item dropdowns. Also I would like to set a different has-children style for the first item.

Does anybody know how this can be done?

Here is my custom walker:

class topmenu_walker_nav_menu extends Walker_Nav_Menu {

    function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
        $id_field = $this->db_fields['id'];
        if ( !empty( $children_elements[$element->$id_field] ) && ( depth == 0 ) ) {
            $element->classes[] = 'has-children'; // Use any classname you like
        }
        Walker_Nav_Menu::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
    }

function start_lvl( &$output, $depth ) {
    // depth dependent classes
    $indent = ( $depth > 0  ? str_repeat( "t", $depth ) : '' ); // code indent
    $display_depth = ( $depth + 1); // because it counts the first submenu as 0
    $classes = array(
        'subnav',
        ( $display_depth % 2  ? 'menu-odd' : 'menu-even' ),
        ( $display_depth >=2 ? 'sub-sub-menu' : '' ),
        'menu-depth-' . $display_depth
        );
    $class_names = implode( ' ', $classes );

    // build html
    $output .= "n" . $indent . '
    ' . "n"; } function start_el( &$output, $item, $depth, $args ) { global $wp_query; $indent = ( $depth > 0 ? str_repeat( "t", $depth ) : '' ); // code indent // depth dependent classes $depth_classes = array( ( $depth == 0 ? 'main-menu-item' : 'sub-menu-item' ), ( $depth >=2 ? 'sub-sub-menu-item' : '' ), ( $depth % 2 ? 'menu-item-odd' : 'menu-item-even' ), 'menu-item-depth-' . $depth ); $depth_class_names = esc_attr( implode( ' ', $depth_classes ) ); $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) ); $output .= $indent . '

Here is my CSS:

.nav-container {
    background: #232323;
        width:100%;
margin-bottom: -5px;
    height: 60px;
    display: inline-block;
}

.nav {
    background: #232323;
    width:996px;
margin-bottom: -5px;
    height: 60px;
    display: inline-block;
}

.nav li {
    float: left;
    list-style-type: none;
    position: relative;
}

.nav li a {
    font-size: 16px; 
    color: white;
    display: block;
    line-height: 60px;
    padding: 0 26px;
    text-decoration: none;
    border-left: 1px solid #2e2e2e;
    font-family: Montserrat, sans-serif;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}
.nav li a:hover {
    background-color: #2e2e2e;
}


#settings a {
    padding: 18px;
    height: 24px;
    font-size: 10px;
    line-height: 24px;

}



.settingsitem a {
    font-size: 16px; 
    color: white;
    display: block;
    line-height: 60px;
    padding: 0 26px;
    text-decoration: none;
    border-left: 1px solid #2e2e2e;
    font-family: Montserrat, sans-serif;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);


}
#options a{
    border-left: 0 none;
}
#options>a {
    background-image: url(triangle.png);
    background-position: 85% center;
    background-repeat: no-repeat;
    padding-right: 42px;
}
.subnav {
    visibility: hidden;
    position: absolute;
    top: 110%;
    right: 0;
    width: 200px;
    height: auto;
    opacity: 0;
    transition: all 0.1s;
    background: #232323;
        z-index:1000;
}
.subnav li {
    float: none;
}
.subnav li a {
    border-bottom: 1px solid #2e2e2e;
}
#options:hover .subnav {
    visibility: visible;
    top: 100%;
    opacity: 1;
}

.nav li.has-children a{
    border-left: 1px solid #2e2e2e;
}
.nav li.has-children>a {
    background-image: url(triangle.png);
    background-position: 85% center;
    background-repeat: no-repeat;
    padding-right: 42px;
}

.nav li.has-children:hover .subnav {
    visibility: visible;
    top: 100%;
    opacity: 1;
}

Wrong current class on admin menu with add_submenu_page()

I’m writing a plugin that displays a post/page list in the admin menu, as a submenu for each post type. Here’s the code I’ve got far: http://pastebin.com/DmUGfzxN

The lists are showing and linking fine. However, I have a problem when I go to another menu, for example, Media, and go to edit a post (or image in this case). The current class that WordPress uses for the admin menu points to the wrong place, and opens the menu for Pages, highlighting the last submenu item.

I believe this is a related problem here: Current class on admin menu using add_submenu_page()

He solved it by adding the submenu page to a page slug, instead of a link like admin.php?=page.... Unfortunately, I want my submenus to be under Post, Page, etc., so I need to use edit.php and edit.php?post_type=....

If anyone has any ideas how to get around this quirk/bug, I’d appreciate it. Thank you.

View Menu and subMenu using parentchild relation in reactnative

I want to show the MENU in this parentchild relation way
Main Display example

I have used recurisve function to implement this, I have come this far BUT
IT IS NOT DISPLAYING THE MENU

Here is data from api
Data from Api

I have also tried to display menu using map and filter function of js but no success in either one. Any Help will be appreciated

    import React from 'react';
            import {
               Image,ScrollView,StyleSheet,Text, View 

            } from 'react-native';

            import Panel from '../../components/BottomTabFiles/Panel';
            import {fetchRestaurantMenu} from '../actions/restaurantMenuAction';
            import {connect} from "react-redux";

            class BookmarkReservations extends React.Component{

            componentDidMount() {

              this.props.fetchRestaurantMenu("getmenu"); //calling api from redux
            }

            MainMethod(){  //This is main method that will be called
                let data = this.props.restaurantMenuDetails.restaurantMenu, 
                  //getting data from redux
                   rawList = [],
                   tempList = [],
                   self = this,
                   MainMenuArray = [];

                   data.forEach(dataItem=>{
                    rawList.push(dataItem);
                    });

      //if an item is parent, then put it into tempList(MainMenu or ParentItem has 
      //m_pid of '00000000-0000-0000-0000-000000000000')

                    rawList.forEach(function(dataItem){
                        if(dataItem.m_pid == '00000000-0000-0000-0000-000000000000')  
                         {
                          tempList.push(dataItem);
                        }           
                      });

                        MainMenuArray.push( 
                          tempList.forEach(function(dataItem){
                            if(dataItem.m_pid == '00000000-0000-0000-0000-000000000000'){  //it's MAIN MENU

                              
                                    {self.BindCategory(dataItem.m_name, dataItem.mid, dataItem.m_pid, dataItem.m_iscategory)}

                                    {/* check for CHILDREN           */}
                                    {self.GetChildCategory(rawList, dataItem.mid)}

                              
                            }
                          })
                        );
                        return MainMenuArray;
                    }

                BindCategory(menuName, menuId, menumPid, isMenu){
                  debugger
                  let bindCategoryArray = [];
                  if(isMenu == true ){
                    console.log("BindCategory called "+menuName);
//THIS is CHILDVIEW that will reside inside MAINMENU
                     bindCategoryArray.push(
                       
                                    
                           

                             

                              {menuName}          
                             
                             
                                (Android-only) Sets the elevation of a view, using Android                  
                             
                           
                       );
                  }

                  return bindCategoryArray;
              }


              GetChildCategory(rawList, categoryId){
                let tempChildList = [],
                  tempCHildArray = [];

                for(let i=0; i< rawList.length; i++){
                    if(rawList[i].m_pid == categoryId){
                        tempChildList == rawList;
                    }
                }

                console.log("GetChildCategory called "+tempChildList);
                console.log(tempChildList);
                 tempCHildArray.push( tempChildList.forEach(function(dataItem){
                    if(dataItem.m_pid ==categoryId ){
                      

                            {this.BindCategory(dataItem.m_name, dataItem.mid, dataItem.m_pid, dataItem.isMenu)}

                            {/* check for CHILDREN           */}
                            {this.GetChildCategory(rawList, dataItem.mid)}

                                    
                    }
                }));

                return tempCHildArray;
            }

            test(){
              let panelArray = [];
                panelArray.push(

                    );
                    return panelArray;
            }

            render(){

              return(        
                    

                      {this.test()} //This test method shows View
                   {this.MainMethod()}  //calling above method does'nt show up View   

            
                );
            }
            }    

            const mapStateToProps =state=> {
              return{
                restaurantMenuDetails: state.fetchRestaurantMenuReducer,
              }
            }

            export default connect(mapStateToProps,{
                  fetchRestaurantMenu
                })(BookmarkReservations);

2 views with same format but diferent filters with submenu

I have a component called “com_requests”. I have a created view called view = “products”. I would like to clone this view and create another one, but only show the products of a type. Is there any way to do this without having to create the “products” view twice?

I have added a submenu with links. The idea is that some users can see only one of the options.

I added in “requests.php”

public static function addSubmenu($vName = '') {
        JHtmlSidebar::addEntry(
            'Products',
            'index.php?option=com_eonquotes&view=products',
            $vName == 'products'
        );
        JHtmlSidebar::addEntry(
            JText::_('Products2'),
            'index.php?option=com_eonquotes&view=products2',
            $vName == 'products2'
        );
    }

I’m lost and I do not know how to do it in the simplest way possible without having to duplicate the work. What files do I need to create / edit? Thanks!!

KUbuntu What is the function of Check and Default Checkboxes on Pin Submenu

I am used to in pinning application in Windows taskbar.

In Kubuntu when I right click an icon in the panel, there is a option called pin. On its submenu there are few options.

enter image description here

I understand On All Activities and On the Current Activity. (Different activities are like different desktops. It is different than the virtual desktop concept. We can create virtual desktops inside Activity. So, I think this is clear.)

However, I do not understand Why the Check and Default checkboxes are there.

Can anyone please explain?

How to avoid creating first submenu page that is same as menu page?

I’ve created menu page and four submenu pages.

public function onixion_admin_menu_option() {
add_menu_page('onixion','Onixion','manage_options','onixion-admin- 
menu',array(&$this, 'onixion_main_page' ),'dashicons-chart- 
area','200');
add_submenu_page(
    'onixion-admin-menu', 
    'scripts',
    'Scripts', 
    'manage_options',
    'scripts',
    array(&$this, 'onixion_scripts_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'custom_footer',
    'Custom Footer', 
    'manage_options',
    'custom_footer',
    array(&$this, 'onixion_custom_footer_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'file_upload',
    'File Upload', 
    'manage_options',
    'file_upload',
    array(&$this, 'onixion_file_upload_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'payments',
    'Payments', 
    'manage_options',
    'payments',
    array(&$this, 'onixion_payments_page' ) 
);

}

Everything seems fine, there are those submenu pages with the text I printed to test them individually.

Onixion

The problem is that the first submenu page is a copy of menu page. What I want is to have different page when someone clicks on main menu option: ‘Onixion’ and to have only submenu pages I’ve added (Without ‘Onixion’ submenu page).

How to avoid creating first submenu page that is same as manu page?

I’ve created menu page and four submenu pages.

public function onixion_admin_menu_option() {
add_menu_page('onixion','Onixion','manage_options','onixion-admin- 
menu',array(&$this, 'onixion_main_page' ),'dashicons-chart- 
area','200');
add_submenu_page(
    'onixion-admin-menu', 
    'scripts',
    'Scripts', 
    'manage_options',
    'scripts',
    array(&$this, 'onixion_scripts_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'custom_footer',
    'Custom Footer', 
    'manage_options',
    'custom_footer',
    array(&$this, 'onixion_custom_footer_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'file_upload',
    'File Upload', 
    'manage_options',
    'file_upload',
    array(&$this, 'onixion_file_upload_page' ) 
);
add_submenu_page(
    'onixion-admin-menu', 
    'payments',
    'Payments', 
    'manage_options',
    'payments',
    array(&$this, 'onixion_payments_page' ) 
);

}

Everything seems fine, there are those submenu pages with the text I printed to test them individually.

Onixion

The problem is that the first submenu page is a copy of menu page. What I want is to have different page when someone clicks on main menu option: ‘Onixion’ and to have only submenu pages I’ve added (Without ‘Onixion’ submenu page).

Always show wordpress submenu on responsive header menu

I’m trying to edit my CSS to always show all the li tags inside my header menu, also with ul.sub-menu li; I just want to show all the items from the menu, but I’m working on it for hours and I’ve still haven’t found any solution.

This is my menu’s structure:


This is what I’ve tried so far:

ul.menu li ul.sub-menu {
    display: block !important;
    visibility: visible !important;
    top: 100% !important;
    position:relative;
}

But all the hidden li are showing at the bottom of the menu, instead after their parent ones, and this is what i get ( code structure is the same, but this is a representation of “how it shows”):


Can someone help me? Maybe I’m missing something really simple, but I’ve not found the solution yet.

Thanks in advice.