I'm new to Drupal, and I'm also building an N-tier hierarchical menu that I want to display sections at time based on the current $node->path.
The menu looks like this -
---Top
------Menu-1
---------Menu-2
------------Menu-3
------Menu-4
---------Menu-5
------------Menu-6
etc etc etc
Each menu is also a page content type in Drupal, so if the $node-path is /top/menu-3, I want to be able to grab only Menu-1 and all its children. As I'm saying this, it almost sounds like I need some xpath in here.
With the Menu Block module, you can create a block to display a menu just like the Drupal's menu built-in menu block but starting at a specific depth. In your example, you can create a block to display your menu starting at depth 2 (Menu 1 and Menu 4) and following the active item (ie. the menu item for the currently viewed page). When viewing Menu 1, Menu 2 or Menu 3, the block will display Menu 1 and its children. When viewing Menu 4, Menu 5 or Menu 6, the block will display Menu 4 and its children. And when viewing Top, the menu will be empty.
Also, it works with non-node pages.
i'm not entirely sure what you're trying to do, but it seems like the node hierarchy module could be your solution.
with this module you can create a node hierarchy which can automatically result in hierarchical menus, hierarchical paths, etc.
Related
I am using the book module navigation block to display links to book pages. I was wondering if it was possible to alter it so rather than the children links appearing below the parent, they would appear to the side. This is because I want a horizontal navigation:
Thanks
You can customize the navigation block with the book-navigation.tpl.php template. You have total control over the HTML within that block from that template. It basically allows links for next, previous and parent elements as well as the display of a list of links to any children. If you want to create a more complicated form of navigation (for instance: a javascript-powered slideshow with slides for every page at the current level of the book hierarchy) you'll have to resort to a custom view and find a way to embed it in the navigation template.
A few questions regarding menus in Drupal 7, I've been looking for solutions but can't quite seem to find anyone else having a similar issue.
Using the Bartik theme:
I have 2 menus - one is the Main menu and allows for me to set children to pages. I have a secondary menu that I do not want to be in the main menu but I do want to allow it to have children. When I add pages, I cannot select my secondary menu in the dropdown to allow my secondary links to have children. I can't even select my secondary menu as an option.
Here are my questions:
Can I allow for my secondary menu to have children without installing a module?
Can I change a setting to allow me to select my secondary menu instead of the main menu when creating pages (without installing a module)?
<main menu>
link 1
link 2
-- sublink 1
-- sublink 2
<secondary menu>
link 1
link 2
-- sublink 1
-- sublink 2
Can I allow for my secondary menu pages to have breadcrumbs without installing a module?
Thanks!
All menues have the same basic function, so yes you can add nodes to your secondary menu.
To make your secondary menu available, you need to change settings on each content type you want to use with this menu.
Go to admin > structure > content types
click "edit", go to "Menu Settings" tab, and enable the menu there.
Now when you create or edit a node of that type you should see that menu available.
I have following navigation structure, which i want to implement in wordpress:
(Home / About / news / Contact) are in top navigation, whereas all sub links are in sidebar.
How can i create this type of navigation in wordpress. i.e. How can i display first level navigation in header and second level navigation in sidebar.
Follow these steps:
First create a main Navigation to your site without child pages and
add it to the theme.
Then create a new menu with child menus only and save it.
Now goto widgets section and from there drag Custom Menu from left
side and add to your sidebar.
Then select your child menu and click save.
Thats all. :)
Check this WordPress Codex section for creating menu tutorial
Cheers!!!
I found these plugins helpful:
Simple Section Navigation
http://wordpress.org/extend/plugins/simple-section-navigation/
It allowed me to create the side nav based on the hierarchy of the pages and their children.
I wanted a bit more control though because I didn't want some of the parents to have their own page ... just a heading for their children. So instead, I'm using this plugin (for the Genesis Framework).
Genesis Simple Sidebars
http://wordpress.org/extend/plugins/genesis-simple-sidebars/
This allows me to create as many sidebars as I want and add custom menus to those. I'm new to this, so maybe I'm taking a long route, but so far it seems to be doing what I want it to.
I only want to show the pages that do not have parents, and link the other pages from their parent pages.
I want to have a simple main menu: Home | Pages | About | Contact
About 8 pages are linked from the Pages page. At the moment, the menu has 12 items, which deforms the layout pretty badly.
I have tried making the pages private, unpublished, and other options, but that doesn't seem to be the way to do it. Is there a way I can just have only parent pages linked in the main menu?
You can edit the menu (under the appearance tab in the dashboard). (you may need to add a new menu and assign it to the main navigation menu. It sounds like you have the defaulted menu set-up.
Once you've added a menu and assigned it to the main navigation, you can uncheck "automatically add top-level elements" or its equivalent, and add/remove menu items. You can also change their hierarchy (independent of actual page hierarchy).
It's all so easy these days. Just Go to appearance>menus>click the little triangle next to the listed page name>click remove> don't forget to save ... all done!
Maybe you didn't set up a custom menu yet. Set up a custom menu first with the desired pages / links. If it doesn't show on your site, check custom memus are enabled in your theme.. this will help you setting up a custom menu: http://www.wpbeginner.com/wp-themes/how-to-add-custom-navigation-menus-in-wordpress-3-0-themes/
I need to develop a kinda Sitemap on the bottom of my website, with all menu items and I was wondering if I can do it with Views.
I actually need to display each main menu item on a different column and add the submenu items to each column.
I realized anyway that Views has not access to Menu items, but only to nodes, or am I wrong ?
thanks
I don't believe you can do this with views. It sounds like you just need to have the top level menu "expanded" in menu configuration and style accordingly. For creating something trickier, that involves multiple levels, check out the menu block module (http://drupal.org/project/menu_block).