joomlamenujoomla3.0submenujoomla-module

How to get customized Joomla menu along with sub-menu


I want add schema in my Joomla menu...! Below is code

<?php
        $menu = JFactory::getApplication()->getMenu();
        // Get menu items - array with menu items
        $items = $menu->getItems('menutype', 'mainmenu');
        //print_r($items);
        ?>
        <ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
            <?php foreach($items as $i => $menu_item){

                ?>
                <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/"><?php if($menu_item->level == '1') { echo $menu_item->title; } ?></a>
                    <?php if($menu_item->level == '2') {?>
                    <ul>
                        <li><?php echo $menu_item->title; ?></li>
                    </ul><?php } ?>
                </li>
            <?php } ?>
        </ul>

problem I am facing is, above not printing sub-menu I could not find any solution

For Example :

<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Home</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">DIFC</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">ADGM</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">About</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Publications</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">FinTech: Now Everybody Wants A Slice of the Pie</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">The Role of Financial Centres in Emerging Economies</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Bitcoin versus Ethereum </a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">ADGM</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">DIFC</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Finance</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Contact</a>
                </li>
                    </ul>

Publication Menu has submenu (FinTech) and two more. I cannot figure it out how to make them print in Submenu


Solution

  • Could you not try this Extension from Tassos Marinos

    Dave