I checked all the bugs reported with related issues like:

All the bugs is reporting that some un-expected results from the menu happens with the active and active-trail classes that must be added to the markup when the current menu link is active.

I tested all the proposed patches their and nothing fixed my bug. Firstly I was using an custom menu block generated from the menu system with no custom modules and I can't see both the active or active trail in the markup. I tried to patch it from #94278 and it didn't work with me.

So, I decided to use primary links or primary menu instead to see the active and active-trail in the markup, In my template I printed the following:

<?php if ($main_menu): ?>
          <div id="main-menu" class="navigation">
            <?php print theme('links__system_main_menu', array(
              'links' => $main_menu,
              'attributes' => array(
                'id' => 'main-menu-links',
                'class' => array('links', 'menu', 'clearfix'),
              ),
              'heading' => array(
                'text' => t('Main menu'),
                'level' => 'h2',
                'class' => array('element-invisible'),
              ),
            )); ?>
          </div> <!-- /#main-menu -->
        <?php endif; ?>

In the theme.info file I added:
features[] = main_menu

In template.php I added the following to add the child-menues to the menu array:

function themeName_links($variables) { 
  if (array_key_exists('id', $variables['attributes']) && $variables['attributes']['id'] == 'main-menu-links') { 
      $pid = variable_get('menu_main_links_source', 'main-menu'); 
    $tree = menu_tree($pid); 
    return drupal_render($tree); 
  } 
  return theme_links($variables); 
}

Everything is working and the menu appears with the child menues, But I can't find the active or active-trail classes in any link in the menu.

I only use Special menu items custom module to be able to make some links without urls in the menu. Disabling this module didn't help too.

Direct link to the site Human Nature Blog the menu on the left sidebar is the primary menu.

I am ready to help and provide any further information.

Comments

JonathanHindi’s picture

Issue summary: View changes

fixing related bugs links

tim.plunkett’s picture

Version: 7.x-dev » 8.x-dev
Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs backport to D7

I can't reproduce this in D7 or D8.

I added a View to the main menu in Bartik, and it properly received an active class.

JonathanHindi’s picture

I am trying to reproduce it on another site but I can't, Any suggestion why I am not receiving an active class on this site. I know I have to open a new issue or support request but if you can give me any guidelines I will be thankful.

tim.plunkett’s picture

Version: 8.x-dev » 7.x-dev
Category: bug » support
Status: Postponed (maintainer needs more info) » Active
Issue tags: -Needs backport to D7

No need, this can be repurposed.

pasqualle’s picture

Status: Active » Closed (fixed)

Adding primary links as you did (in you first code snippet), and as core themes do, will display the active class correctly.

I don't not really understand why are you trying themeName_links(), but there is one problem with this code

$tree = menu_tree($pid);
return drupal_render($tree); 

This will not add active class to menu items.

The replacement would be:

$tree = menu_tree_page_data('main-menu');
$build = menu_tree_output($tree);
return drupal_render($build);

But I would recommend using the https://drupal.org/project/menu_block module if you have special menu requirements.

pasqualle’s picture

Issue summary: View changes

fixing the first bug link