Hi Guys,

I have created a custom theme using bootstrap theme. My menu blocks are not going to appear in my theme. Only title of menu block is going to display. I have tried to add custom code in my page.tpl file but not getting result. Please guide me how I can fix this. Below are the details of my custom menu block :

URL of my menu block :
admin/structure/block/manage/menu_block/5/configure

Code that I have used in page.tpl file is :

$block = module_invoke('menu_block', 'block_view', 3); 
print $content;

Please reply me soon. I will be very thankful.

Thanks,
Nidhi

Comments

vivekguptakota’s picture

Try This once. I am not sure but it may be work for you.

$menublock = block_render('menu_block', '3');
print $menublock;

nidhitiwari’s picture

Thanks Vivek for your quick reply. I used this code in my page.tpl file and getting error "Call to undefined function block_render() in"

nidhitiwari’s picture

When I use
$block = module_invoke('menu_block', 'block_view', 5);
print render ($block['content']); print $block['subject'];
it's going to print subject but not content

Shashwat Purav’s picture

Thank You,
Shashwat Purav

nidhitiwari’s picture

Hi Shashwat,

Thanks for your reply. But it's not working for me. let me explain you want I want to do. I have created a menu block. I have also created menus for the same. When I assign this menu block in first_sidebar of my custom developed theme(By taking reference of bootstrap theme) menu list is not going to display menus there. Please help me to fix this issue asap. I will be very thankful to you.

Thanks,
Nidhi

Shashwat Purav’s picture

menu list is not going to display menus there.

Did you inspect the block in browser to see whats coming?

Thank You,
Shashwat Purav

nidhitiwari’s picture

Hi Shashwat,

I have send you skype request. Could please help me to fix this asap ? It's very urgent for me .

I can see below code on browser :

nidhitiwari’s picture

Thanks guys for you replies. I have fixed my issue by using below code.
function themeName_menu_tree__menu_block(&$variables) {
$block = module_invoke('menu_block', 'block_view', 3);
return '

    ' . $variables['tree'] . '

';
}

I have fixed issue for my block which is having id 3. But it is not permanent solution for all blocks. Could some one can help me to modified this so that It can work for all blocks.

Thanks,
Nidhi

VM’s picture

it significantly helps others if when placing code in posts on drupal.org that you utilize code tags.

nidhitiwari’s picture

Hi,

Could some one pls help me to fix this static menu block id issue. I want that this code should work with every menu bloack not only for id 3

VM’s picture

=-=