I'm trying to figure out how one would add a custom top level admin menu with a handful of submenus without having the top level one repeat itself in the submenus.
This is what i want:
Posts
All Posts
Create
etc.
Click on posts and get to the "all posts" page. All I'm getting is:
MyPostType
MyPostType
etc.
I want it to be MyPostType > All MyPostTypes.
Hope somebody can help. I'd appreciate it! thanks
//EDIT
Trying to rephrase here (seems like people don't get my question, sorry for my lacking language skills)
I'm talking about the left hand menu in the admin area
I'm not looking for a plugin to make changes to that menu, I'm looking for code
of course I'm trying with add_menu_page and add_submenu_page but I can't get them to do what i want.
here it is again:
Using add_menu_page('MyPostType',...) and add_submenu_page('Options',...) gets me a top level menu entry called MyPostType with two submenu entries called MyPostType and Options. If you look at e.g. the Posts top level menu entry, they somehow managed to rename Posts(Submenu) to All Posts. That's what I want:
MyPostType
All MyPostTypes
Options
hope someone knows how to do that. thanks!
Make sure you are using the add_menu_page() method and add_submenu_page() method.
What does your code look like at the moment?
So I figured it out by myself. her's how you'd do it.
use add_menu_page to create the top level menu entry. give it a slug to identify it.
use add_submenu_page to override the submenu entry created by add_menu_page. to override just give it the parents slug as the parent parameter. give it that exact same slug as the menu_slug parameter. that does the trick. now add as many more submenus as you want.
Related
How to find where my page titles exists in my database and how to merge with my menus? Maybe I can easily change them using phpmyadmin?
I found that Apearance->Menus is a nightmare when i have more than 40+ menu items. I want to get a workaround idea?
The menu items in the list are derived from each page's title. If you want to create a custom menu editor, use wp_nav_menu. It also helps to make sure that you set each page's parent page.
It might pay to look for a menu editor plugin, as I am sure they exist (No I havn't looked).
I want to add widget in second layer of wordpress menu. and it should be changable from admin panel. as for example if i add calendar widget in second layer than it can be move to another menu or should be able to add another widget.
It might be a little too late, but here's the solution I've found to this problem. It might still be helpful to someone out there ;P
First I tried making use of the Max Mega Menu plugin, it was giving too many features I didn't need besides the ability to add widgets to the menu.
But the following plugin takes care of that in a very simple and practical way: Widgets in Menu.
Give it a try, this one did it for me ;)
Ok, I know that there are several other questions on SO regarding this topic. By now, I have probably read all of them. I have been researching this for a little over two hours now and I am coming to the end of the road (about to give up!)... So, here I am on SO finally asking the question to involve other sharp minds.
I am helping build this Wordpress site: greatman.us. And, the Posts page is located on a page called "Blog." The "active" menu item is highlighting properly on PAGES, but when you go to a POST, the "Blog" menu item is not longer highlighted (i.e. NOTHING is highlighted in the header menu).
There is no way in Wordpress - as far as I'm aware - to create a "parent" for a blog post. This option is only available for Pages. I need to be able to have the "Blog" menu item stay highlighted when I am viewing a BLOG POST.
For a general example:
mywebsite.com/blog/ <--- menu item "Blog" is highlighted
mywebsite.com/blog/post223 <--- menu item "Blog" is no longer highlighted
I am proficient with CSS and HTML, but not with PHP. So, if this is a PHP fix, please dumb your answer down as much as possible.
I have read tons of other articles about this online and it seems to be a common issue, with most people not knowing how to code with PHP.
I am using a custom theme, called Divi. And it is missing some of the CSS elements that other forums and sites I have read said that the style.css should have. This is another reason I am coming to a dead end. Please help!
By the way, one WORKAROUND I discovered is to add POSTS as sub-menu items to the "Blog" page that you made in the Wordpress Menus area (in the admin back-end). Then, use "display:none" is CSS to remove the submenu from being displayed to the public. This causes two main problems, though: 1) You can never have any other sub-menu items, because they won't be displayed. 2) You have to manually add every single blog post to the menu as a sub-menu item. This will eventually make your menu super long assuming you are a regular blogger. It is also a hassle.
Within your CSS, you will also need to add .current-page-ancestor with the same attribtues as your current menu item.
Something similar to below:
.current_page_item, .current-page-ancestor {
// Some attributes
}
This is guessing that you have use wp_nav_menu() though. If not then I'll need to see what code you have used to generate the menus.
I created a container with a couple of forums. How do I get it to appear in my menu?
I have book called "community", and I want the forum container to appear as a child of that book. I thought I could do it by using a view. I selected node:type-->forum topic as a filter, but I don't know what to enter in this field. It doesn't seem to be working.
How can I do this?
If you have just a few containers, you can simply create the menu links by hand, make sure that you have the menu.module enabled.
You can also check out http://drupal.org/project/taxonomy_menu, it allows to display taxonomies in the menu automatically and forums depend on taxonomy.
Is there a way to make every content type default to the parent in the menu.
ie say i have content type called "cats" . How do i make all "cats" automatically sit inside "pet" menu item. Also can i alphabetically sort "cats" in the menu
You could do this programatically, with a custom module.
in hook_nodeapi() op=="insert", you can check for the $node->type and then use menu_link_save() to create the menu item.
Afaik you cannot manipulate the order of menu items -- however you could perhaps accomplish the same effect by using Views.
You can default every content type to a specific menu on admin/build/menu/settings and change the "Default menu for content" setting to your menu. But this will default ALL content types to that menu. For this problem you might also want to look into views.
Hope that helps!
It looks like there's a Drupal module that does this
This tutorial does exactly what you want (and it's very easy to do)
This also uses menu_link_save(), but you won't have to create a module.
That sounds like it can be accomplished by setting up the menus appropriately. Take a look at the video here where the trainer sets up pretty much exactly what I think you've described.
Hope that helps...