Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By nidhitiwari on
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
Try This once. I am not sure
Try This once. I am not sure but it may be work for you.
$menublock = block_render('menu_block', '3');
print $menublock;
Thanks Vivek for your quick
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"
When I use
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
Try this:
Try this:
[SOLVED]Printing a block in node.tpl.php
Thank You,
Shashwat Purav
Hi Shashwat,
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
menu list is not going to
Did you inspect the block in browser to see whats coming?
Thank You,
Shashwat Purav
Hi Shashwat,
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 :
Thanks guys for you replies.
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 '
'.$block['subject'].'
' . $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
=-=
it significantly helps others if when placing code in posts on drupal.org that you utilize code tags.
Hi,
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
=-=
=-=