How to style menu local tasks Problem

I'm trying to theme the menu local tasks that Drupal places without any unique css classes. How would I do this? 

(Specifically I'm looking to hide certain links on certain pages by giving each one a unique css class).

Links Sample HTML



Which is generated by this line in page.tpl.php.

&lt;?php if ($primary_local_tasks): ?&gt;&lt;ul class='links'&gt;&lt;?php print render($primary_local_tasks) ?&gt;&lt;/ul&gt;&lt;?php endif; ?&gt;


So Far

To do that I'm trying to use theme_menu_local_tasks however I can't get it to work. I've put this snippet in my template file but it doesn't print anything or show me any variables. 

function tefltheme_menu_local_tasks (&amp;$variables) {
  dpm($variables);
  print("hello");
  return theme_menu_local_tasks($variables);
}


I'm using Tao sub-theme which means it splits menu local tasks into primary and secondary.

function tao_preprocess_page(&amp;$vars) {
  // Split primary and secondary local tasks
  $vars['primary_local_tasks'] = menu_primary_local_tasks();
  $vars['secondary_local_tasks'] = menu_secondary_local_tasks();


Could this be affecting anything?
theme_menu_local_tasks() will never be invoked using those two methods, so it makes sense that your dpm() fails.

Both functions do eventually invoke hook_menu_local_tasks_alter(), though, and that's where you can make your changes:

function MYTHEME_menu_local_tasks_alter(&amp;$data, $router_item, $root_path) {
  if ($some_condition) {
    // Grab the first tab.
    $first_tab = &amp;$data['tabs'][0]['output'][0];

    // Add a class to the link element.
    $first_tab['#link']['localized_options']['attributes']['class'][] = 'some-class';
  }
}


If you want to add a class to the &lt;li&gt; element you'll need to go a step further, and override theme_menu_local_task(). 

The class attribute is hard-coded at the moment so that'll will need to be changed, based on a contextual variable you can pass into the theme function from the local tasks hook above.

That would look something like this in the alter hook

$first_tab['#extra_class'] = 'some-class';


And along these lines for the theme function

function MYTHEME_menu_local_task($vars) {
  // Copy the code from theme_menu_local_task() but change the HTML output
  // to include an extra class if $vars['extra_class'] is set
}


You might also need to implement hook_theme_registry_alter() to let it know about the new variable (can't remember if it matters but it can't hurt)

function MYTHEME_theme_registry_alter(&amp;$theme_registry) {
  $theme_registry['menu_local_task']['variables']['extra_class'] = NULL;
}