How to make Drupal highlight the same menu item for 2 different nodes (URLs) When defining the menu item, I can only choose a unique URL for language. But I want that a bunch of pages, one of them the referenced by the menu item, highlight that menu item (Products) so I know I am in that section of the page. For example:

www.example.com/products
www.example.com/search-product
www.example.com/product-detail


all would have to highlight the menu-item := products, that which references the first URL above.

I have tried with the following code but I am not sure if there is a faster and more direct approach, it seems too convoluted to me to theme() nothing to keep the above desired effect

Code:

   print theme('links__system_main_menu', array(
        'links' =&gt; $main_menu,
        'attributes' =&gt; array(

        ),
        'heading' =&gt; array(
          'text' =&gt; t('Main menu'),
          'level' =&gt; 'h2',

        ),
      ));  


function theme_links__system_main_menu($variables) {
  $html = "&lt;ul&gt;";  
  foreach ($variables['links'] as $link) {


  // HERE I would change $link['href'] to merge the 3 links
  //together and make that this item is hilited when I am in one of the 3  
  //links. Of course, the href link will direct to the first one, but
  //the hilite will make the user to know that she is in this section.


    $html .= "&lt;li&gt;".l($link['title'], $link['href'], $link)."&lt;/li&gt;";
  }
  $html .= "  &lt;/ul&gt;";
  $html .= "";

   return $html;
}


Another coded approach:

 $a = menu_tree_output( menu_tree_page_data("main-menu") );
 print "&lt;ul&gt;";
foreach($a as $key =&gt; $value){
 active = "";
   if($value["#href"] == current_path() || ( drupal_is_front_page() &amp;&amp; $value["#href"] == "&lt;front&gt;" ) ){
     // HERE I would change $link['href'] to merge the 3 links
    //together and make that this item is hilited when I am in one of the 3  
    //links. Of course, the href link will direct to the first one, but
    //the hilite will make the user to know that she is in this section.


    $active = 'class="active"';
   }
        if($value["#href"] == "&lt;front&gt;"){
            $url = "";
        }else{
            $url = drupal_get_path_alias($value["#href"]);
        } // if
        if($value["#title"] != "") print '&lt;li&gt;&lt;a ' . $active . ' href="' . $base_url . "/" . $language-&gt;language . "/" . $url . '"&gt;' . $value["#title"] . "&lt;/a&gt;&lt;/li&gt;";
    } // foreach
     print "&lt;/ul&gt;";
Recently I've the same needs in my site and the fastest and painless approach was doing in CSS instead create preprocess functions.

This was done in Drupal 8, but works independently of what you are using. 

First make sure that you have a class or id named with your path in any place of your HTML, and then, just use it to style your link with same 'active' class. Something like this...

HTML:

&lt;body class="path-product-detail"&gt;
  &lt;header&gt;
    &lt;nav class="main-menu"&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href="/home"&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="/products"&gt;Products&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="/contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;nav&gt;
  &lt;/header&gt;
  ...
&lt;/body&gt;


CSS:  

.main-menu .active, 
.path-product-detail .main-menu a[href="/products"] {
  color: #fff;
  background-color: #c9093e;
}


Try in JSFiddle:
https://jsfiddle.net/t4vny2df/1/

Edit 1: Detailed explanation
First of all, in your html.tpl.php template make sure that the current path is printed as a class, this will be dynamically specified, all the magic is right here in this class (in Drupal 7, by default, seems the class is page-'currentPath' according docs).

Your HTML must print current path in body element.

&lt;body class="page-currentPath ..."&gt;
...
&lt;/body&gt;


Now, based in this class just use the right CSS selectors to highlight the menu item. I'm going to use the 'products' html code example.

.main-menu /*Note 1*/ .active /*Note 2*/, 
.page-product-detail /*Note 3*/ .main-menu a[href="/products"] /*Note 4*/, 
.page-search-product /*Note 5*/ .main-menu a[href="/products"] /*Note 4*/{
  color: #fff;
  background-color: #c9093e;
}


First, in CSS we can use a combination of selectors do get the right element and we can use 'comma' to specify another selector to the same style (a, p{color: #000} /*Element 'a' and element 'p' will be color black*/)

Note 1 - Considering your menu with a class 'main-menu'.
Note 2 - Considering that you are using a 'active' class for current path.
Note 3 - If body has a class 'page-product-detail' this selector will be considered.
Note 4 - This selector will get the menu item that you want highlight and doesn't have a 'active' class, because you are not in '/products' page.
Note 5 - If body has a class 'page-search-product' this selector will be considered.  

For more pages just add another line with your 'page selector'. Any questions just leave a comment and I explain.