Customizing SMF > Graphics and Templates
Displaying selected buttons outside template_menu()
phantomm:
Hi, I saw this in few themes, but couldn't find out how this is done.
How to display buttons Register and Login in index.template.php but hide them in template_menu() ? Don't remember where I've seen it, but I hope you understand what I mean :)
Suki:
If you are using 2.0 you can just remove those buttons from the array or set the 'show' => to false: 'show' => false, the just add your buttons manually to your template where you want them, the url is pretty simple in both cases: ?action=login and ?action=register
phantomm:
Yes, I'm using 2.0.2, I want to limit all edits in theme, because if I hide buttons in Subs.php then they will be hidden in other themes
Suki:
So, you want to only hide some buttons on specific themes?
You could do a ternary on 'show' => to check what is the theme the user is using and if is equal to X then disable the button with false.
Arantor:
You could modify your theme's template_menu() to just not show the buttons in that theme... in the loop, check for the button's id and if it's login or register, just don't show it.
This is what some of DzinerStudio's premium themes do.
All we're really talking about is finding this line in template_menu:
--- Code: --- foreach ($context['menu_buttons'] as $act => $button)
--- End code ---
And adding after it:
--- Code: ---if ($act == 'login' || $act == 'register')
continue;
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version