1

I am using a custom Joomla template called 'Portent' built by Joomlanauts -- a @SethWarburton creation.

The issue which I am facing is that the Sub-menu under my Child menu items are not showing for some reason.

How can I show the child submenu?

1) Here I have sub-menu:

enter image description here

2) Here is what I have on my Joomla Menu setup:

enter image description here

3) Under Joomla module 'Menu' I have selected to show 'Sub-menu':

4) Under the "html/mod_menu/bs-dropdown.php" in template "portent"."

<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_menu
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

// Note. It is important to remove spaces between elements.
?>
<?php // The menu class is deprecated. Use nav instead. ?>
<ul class="nav <?php echo $class_sfx;?>"<?php
    $tag = '';

    if ($params->get('tag_id') != null)
    {
        $tag = $params->get('tag_id') . '';
        echo ' id="' . $tag . '"';
    }
?>>
<?php
foreach ($list as $i => &$item)
{
    $class = 'item-' . $item->id;

    if ($item->id == $active_id)
    {
        $class .= ' current';
    }

    if (in_array($item->id, $path))
    {
        $class .= ' active';
    }
    elseif ($item->type == 'alias')
    {
        $aliasToId = $item->params->get('aliasoptions');

        if (count($path) > 0 && $aliasToId == $path[count($path) - 1])
        {
            $class .= ' active';
        }
        elseif (in_array($aliasToId, $path))
        {
            $class .= ' alias-parent-active';
        }
    }

    if ($item->type == 'separator')
    {
        $class .= ' divider';
    }

    if ($item->type == 'heading')
    {
        $class .= ' muted';
    }

    if ($item->deeper)
    {
        $class .= ' dropdown nav-stacked';
    }

    if ($item->parent)
    {
        $class .= ' parent';
    }

    if (!empty($class))
    {
        $class = ' class="' . trim($class) . '"';
    }

    echo '<li' . $class . '>';

    // Render the menu item.
    switch ($item->type) :
        case 'separator':
        case 'url':
        case 'component':
        case 'heading':
            require JModuleHelper::getLayoutPath('mod_menu', 'default_' . $item->type);
            break;

        default:
            require JModuleHelper::getLayoutPath('mod_menu', 'default_url');
            break;
    endswitch;

    // The next item is deeper.
    if ($item->deeper)
    {
        echo '<ul class="dropdown-menu">';
    }
    elseif ($item->shallower)
    {
        // The next item is shallower.
        echo '</li>';
        echo str_repeat('</ul></li>', $item->level_diff);
    }
    else
    {
        // The next item is on the same level.
        echo '</li>';
    }
}
?></ul>

@grant-g this is what I get under inspect element :( enter image description here

@SethWarburton any advise on this?

  • 2
    Thank you for joining the community. I think you have done a very good job of expressing your first question. Volunteers may have some follow up questions for you to clarify such as "can we see the rendered html of the broken menu?". Please continue to investigate your issue and attempt to self-solve. If you manage to solve it yourself, please write an informative answer. If you receive an answer that doesn't quite satisfy, please leave them a comment to help them to understand what isn't yet resolved. – mickmackusa Jun 14 at 0:52
  • Please read my comments in this code review: 3v4l.org/0IJ5n – mickmackusa Jun 14 at 1:33
  • 1
    I think that if you've paid money for this template then you shouldn't be experiencing these sorts of difficulties with basic things like submenus. Plus I can't see any support arrangements on the site where you bought the template. And also given mickmackusa's comments on the template author's code, I think you should apply for a refund and get a template from somewhere else. You really shouldn't have to be changing the code of a purchased template to get it to work. – Robbie Jackson Jun 14 at 18:18
  • thanks for your revert. the situation is I have paid for this template and sending a request to their support email for the past 2 weeks no response at all from them :( Not sure why they are ignoring me :( :( .. So I am afraid that they will not give a refund also as you can see there is no response at all for whatever reason from the developer. By the way I love this template its super lightweight and lightning fast to load exactly what I was looking for. If somehow I could get the child sub menu to show then all is good to implement this new template on my live website.. – ta1982 Jun 14 at 18:46
  • I see they've got a place on their site to request a refund. Applying for that might get their attention, even if you decide to keep the template at the end of the day. – Robbie Jackson Jun 14 at 18:58
0

Untested, but I think you ought to change:

    if ($item->deeper)
    {
        $class .= ' dropdown nav-stacked';
    }

To something like this:

    if ($item->deeper) {
        if ($item->level > 1){
            $class .= ' dropdown-submenu';
        } else {
            $class .= ' deeper dropdown';
        }
    }

You may want to use Chrome Dev Tools inspect, to identify the desired submenu dropdown, and add the appropriate class. The classes above are Bootstrap 3 classes. I also think your mod_menu template has been modified for your template, so you might want to look at putting nav-stacked class in parent nav element, so <ul class="nav nav-stacked>

| improve this answer | |
  • Hi, I tried your code but still the child submenu doesn't appear :( . – ta1982 Jun 14 at 17:50
  • As per comment below; submenu is now in source code, but isn't rendered due to CSS. I've commented below to help find the offending CSS class causing your new behaviour. – Grant G Jun 14 at 20:43
  • Hi, But the inspect element was already showing the child sub-menu items before applying your code. The issue is it is not showing on the menu dropdown – ta1982 Jun 15 at 7:55
  • See here - imgur.com/a/SV0FjtC - your problem is with the template CSS inspect the "Not Rendered" elements in the screenshot on that link. – Grant G Jun 15 at 9:58
  • Thanks for your help in finding the issue. How can I fix this? is it possible to add some kind of CSS to show the submenu? Sorry, I am just a publisher and not familiar with coding etc. :( – ta1982 Jun 15 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.