Skip to content

Instantly share code, notes, and snippets.

@vdchristelle
Created September 23, 2013 14:51
Show Gist options
  • Save vdchristelle/6671603 to your computer and use it in GitHub Desktop.
Save vdchristelle/6671603 to your computer and use it in GitHub Desktop.
Function adds the main-menu items to taxonomy menu block
<?php
function the_aim_theme_preprocess_taxonomy_menu_block(&$variables){
//only for block with delta == 1
if ( 1 == $variables['config']['delta']) {
$links = menu_tree('main-menu');
$main_links = array();
foreach ($links as $link) {
if(isset($link['#original_link']) && !empty($link['#original_link'])) {
$original_link = $link['#original_link'];
$main_links[$original_link['mlid']] = array('name'=>$original_link['link_title'], 'path'=> $original_link['link_path'], 'depth'=>0, 'parents'=>array(), 'active_trail'=>'0', 'children'=>array());
}
}
//switch both arrays in the merge if you want the term links to be appended or prepended
$variables['items'] = array_merge($main_links,$variables['items']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment