By vincentc on
Hello,
Is there a clean way to remove the view/edit tabs on a node page?
The only solution I could come up with so far is to add the following to the stylesheet:
.tabs {
display: none;
}
But it's not perfect: it hides ALL node tabs on the site while I want to remove them only for CERTAIN node types.
Thanks,
Vincent
Comments
Why do you want to hide the
Why do you want to hide the view and edit tabs?
Only users with permissions to edit the node will see the edit tab. Everyone else doesn't see anything because when there is only one tab, nothing is displayed.
----
http://PointHomes.com
Only users with permissions
Thanks, but I know that. And precisely, I'd like users with the appropriate permissions to view/edit a node not to see the view/edit tabs.
Why? Because I have a custom display (theme) for my node including the view/edit buttons, so I don't want the default tabs to show because 1) the buttons appear twice; 2) it "ruins" my layout ;)
Ah, ok
Ah, ok. If I were you, I would apply the styling of the new tabs to the existing li's.
If not, look at http://drupal.org/node/11811
You need to create a template.php file in your theme's folder. The function you will be replacing with the template.php file is theme_menu_local_tasks() in the menu.inc file.
The current function looks like this:
If you want the current node type to be inserted into the tabs:
If you want not to return anything if it is a certain node type:
Modify the array with 'page' and 'audio' to your desired node types.
This will place the node's type into the ul's class attribute. I hope this works (I just typed it straight) and helps.
----
http://PointHomes.com
Thanks a lot
That's great, Michael. Overriding
theme_menu_local_tasks()fits the bill perfectly!! I was not even aware of its existence... ;-)Thanks a million for taking the time to respond.
Have a nice weekend,
Vincent
How about on a profile page?
I see how using this works with all sorts of nodes, but how can I hide tabs on my user profile pages?
Many thanks for any suggestions. I am baffled. EDITED: ahh... found it- http://drupal.org/node/77781
Well... two years later, the
Well... two years later, the above works for removing tabs on a nodeprofile but not when you're using a usernode to display nodeprofile info.
So, in order for that to work (i.e. when your URL looks like 'user/XX' not 'node/XX'), remember to change the line:
FROM:
TO:
I don't know how this: http://agaricdesign.com/note/removing-view-tab-from-embedded-profiles-us... actually works. I don't think it does.
Removing tabs on user profil page
what you can do is, you can create a seperate tpl file for user profiles there you can remove tabs.
just copy the same page.tpl.php and rename it to page-user.tpl.php and comment "print $tabs", it will not show tabs on user profile page.
Work Hard to understand what you have to do b4 U start, You may not be able to develop every detail but the more U know the less risk you take.