• Hi,

    I want to display sub menu items of a specific menu item.

    I got a solution here: https://www.ordinarycoder.com/wordpress-wp_nav_menu-show-a-submenu-only/. It works charm, but actually I need to add some elements with the generated sub menu items. I am unable to add elements such as div, span etc. to them as they are generated with their own markup.

    Please help me to generate them as an array.

    -Menu_id_100
    –sub menu1
    –sub menu2
    –sub menu3
    -Menu_id_150
    –sub menu1
    –sub menu2

    I want to get all the sub items of Menu_id_150 as an array. (which are sub menu1, sub menu2).

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Aboobacker.

    (@abooze)

    This is what I want:

    <?php
       $args = array(
        'order'                  => 'ASC',
        'orderby'                => 'menu_order',
        'post_type'              => 'nav_menu_item',
        'post_status'            => 'publish',
        'output'                 => ARRAY_A,
        'output_key'             => 'menu_order',
        'nopaging'               => true,
        'update_post_term_cache' => false );
    
       $items = wp_get_nav_menu_items( 'Sidebar Menu', $args );
    
       foreach($items as $item ) { ?>
    
           <li class="menu">
    
                <?php if( !$item->menu_item_parent ){ ?> <a href="#" class="linker"><?php echo $item->title;?></a><?php } ?>   
    
                <?php  if( $item->menu_item_parent ){ ?>
                    <a href="#" class="opener"></a>
                        <div class="slide">
                            <div class="holder">
                                <ul>
                                    <li>
                                        <a href="#"><?php echo $item->title; ?></a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                 <?php } ?>    
    
            </li>
        <?php }  ?>

    But only a single second level menu is showing. How to do a foreach there?

    Dear
    Login to wordpress from another PHP site

    This is feeling quite difficulty for me. Please help.
    I’ve a website created with cake PHP in root domain (say mysite.com) and a blog in a directory called “blog” (mysite.com/blog).
    I have a register/login feature in the PHP site. So what I want here is, whenever a member login to the main site using the PHP login form, and after he open the blog (mysite.com/blog), he should logged-in as the same user logged in the main PHP site. In the same way, whenever a new user sign-up with the registration form in the main PHP site, he should become an user in the wordpress blog.
    At this moment, please help me in the case of login only.
    Thanks.
    You have asked this question 1 year ago and today I’m facing the same problem.If you have solved this issue plz help me out.
    From main site registration “Insert query deatils has be send to wp_user table and main site table”. The main problem is that I need to login from wp-admin also with same details then login is working.
    Pease help me out.
    Thanks in advance ??

    Thread Starter Aboobacker.

    (@abooze)

    Hi,

    I had found a solution for this in that time. I remember I did this by catching the registration values and injecting them to WordPress database in the same time using codes. Remember wp_users and user meta table I think. Not in desk now so can’t tell exact table names. Check the user tables as well.

    Will try to get the code for you. If I get, will definitely Post here.

    Thanks,
    Aboo

    Thanks
    I appreciate you for the help.
    I have injected the registration values in wp_users but not in wp_usermeta.
    I need to login from admin to with same details of login with php site.
    Help me Please

    Thread Starter Aboobacker.

    (@abooze)

    Hi,
    WordPress creates a session when you login. So in your cakePHP code, you have to define this session. Also you have to load WP on the cake PHP.

    Search yourself on how to load WP headers (functions) on external PHP files ??

    And these would be useful for you:

    https://codex.www.ads-software.com/Function_Reference/wp_hash_password
    https://codex.www.ads-software.com/Function_Reference/wp_login
    https://codex.www.ads-software.com/Function_Reference/wp_set_auth_cookie

    Good Luck.

    Note: You have posted this under a wrong question. (may be to notify me). But keep creating them as new topics.

    Thanks,
    AB

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display sub menu items of a parent menu – wp_nav_menu’ is closed to new replies.