I have pages that I've organised to be under another main page but it isn't showing up under the secondary menu.
How do I get the secondary menu to display child pages of the current page?
Would there be a theme that does this already, i've tried zen and stark but they don't list the pages organised under the current page.
This sounds like a bug that I've run into myself: Custom menus never receive an active trail
I've explained a workaround in a duplicate issue.
To sumerize:
The problem is that Drupal core active trail, breadcrumb and menu expansion only work for a set of core menus, defined as:
$menus = variable_get(
'menu_default_active_menus',
array_keys(menu_list_system_menus())
);
There is no interface to change this, but you could do it in your settings.php and add the names of the menus you have created. Not a practically solution, but at least it works. You don't usually create new menus that often, so should be fine. An example of what to put in your settings.php file:
$conf['menu_default_active_menus'] = array(
'navigation', // Core menu
'management', // Core menu
'user-menu', // Core menu
'main-menu', // Core menu
'menu-products', // Custom menu
'menu-custom-menu', // Custom menu
);
The Menu Block module works well for displaying the kind of sub-menu you're describing. The module's administration page has lots of options though, so it can take a while to tweak it to get just what you need.
Related
I am working on a WordPress shop. I am using the WooCommerce plugin.
I need to add a second responsive menu. The problem is, that menu items will change depending on the page. For example, the menu needs to be different for the 'shop' page and the 'about' page.
Without WooCommerce (in pure WordPress), I would simply use different header templates for each page (by using page templates). In WooCommerce it seems to work differently.
I don't want to use plugins. How can I do it?
If you have access to the source, you can use conditionals in PHP.
For example:
if(is_page(('shop')) :
('your_shop_menu'); // consider fix this php, it's example only (you can use is_shop() when is Woocommerce Home Shop)
elseif(is_page(('about')) : // You can use page's slug
('your_about_menu'); // consider fix this php, it's example only
else :
('your_default_menu'); // or empty if you don't need menu
endif;
Please see
https://docs.woothemes.com/document/conditional-tags/
https://codex.wordpress.org/Conditional_Tags
Edit: You can manage differents menus via WP Admin
Menu for Shop Page
Menu for About Page
Is it possible to implement a new admin menu in Drupal 7?
Currently I am using Seven theme.
What I want to do is adding another tab on the Content menu with just: Comment, Comment to content, Comment, Submission.
I added a new menu on the admin menu structure, but the menu is not showing anywhere.
I made page--admin--content--submission.tpl.php to start making the interface, but I can't make it according to the current selected admin theme.
Please point me somewhere since I already googled with no luck.
Update screenshot :
Did you try clearing your cache? You can do that via the Performance page, at yoursite.com/admin/config/development/performance.
Developing a wordpress plugin I have problems to setup a custom edit page to handle my items in the admin area. I have been taking a look what is the workflow in case of posts and as I see all edit actions are redirected from edit.php to post.php?post=33&action=edit. I have been setting up an option page and I handle from here all items edits but in this case shows the menu in the sidebar what is not optimal for the user, because if no item id is passed to it can cause a lot problems. I have to mention, developing Wordpress plugins is something new for me and maybe the researches what I made are not proper. I have been taking a look in wordpress API and I found the following function
add_management_page().
but this needs to be ordered under the admin menu
adding the following function and linking my items edit like
admin.php?page=parser-target-edit&record=73
add_submenu_page( 'parser-top-level-handle', 'Edit', 'Sub-menu title', 'manage_options', 'parser-target-edit', array($this , 'edit_item') );
is working but as I said is showing up in the sidebar as menu item. So it has to be another workaround what it can be used in case of edit action
You can try add_menu_page() which can be coupled to add_submenu_page() to create administration pages
You can execute a callback function that gets executed from add_menu_page().
In Drupal 7.0, when I change a routing path/menu from the type MENU_NORMAL_ITEM to the type MENU_CALLBACK, Drupal 7.0 does not remove the item from the menu_links table. I'm not sure if this is a bug or not, but I've filed one with the core team.
With that context in place, is there a way to force Drupal to do a rebuild of all its navigation menus? The bug I've described above is happening even when I clear out Drupal's cache after changing a Menu item.
I know I can rename an individual menu route, clear cache/refresh, and then name the item back to get any individual route/menu link flushed. I'm looking for a single command I can run (or function to call, or set of commands) and know all the menu navigation is up to date without worrying I've hosed some other part of the system by messing with internals.
Does this exist? If you're going to mention drush or devel, you're awesome, but specific instructions on those tools are what I'm after.
Note that although there are options to rebuild the menu (see the other answers), these might or might not work to clean up issues with menu links.
Rebuilding the menu just rebuilds the menu router items and the menu links as far as they are automatically generated based on the menu router items. There are known issues with that, for example re-parenting menu links (http://drupal.org/node/550254). If menu links have been customized or added manually (or Drupal thinks they have been changed.. ), then these will not be touched.
As mentioned in another question already, the tight coupling between these two systems will probably be changed in D8 so that you will have to declare menu links separatly from menu router items.
Here is another option for when you're not able to access the site or do not have Devel or Drush installed. Create a file such as rebuild.php and place it in your Drupal root (though it doesn't matter because chdir will switch to the specified Drupal root). Then after you visit that script it should rebuild the menu's and all should then be well on the site.
<?php
// Bootstrap
// Change chdir to the full path of your Drupal root
chdir('/home/myusername/public_html/');
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// Rebuild
menu_rebuild();
?>
variable_set('menu_rebuild_needed', TRUE);
I came across the same problem. I switched from MENU_NORMAL_ITEM to MENU_CALLBACK and could not get rid of the menu items in the navigation block. I tried a couple of the solutions above with no success. What worked for me was commenting out my menu items in hook_menu, clearing cache, re-enabling them and clearing cache once again.
This is what I returned in Hook_menu to clear all menu items:
return array(); //$items;
Visiting the modules list page generally rebuilds the menus.
You can also try installing Dev modules Enable the dev block and you have a link for rebuild menus.
There are many ways to do it but the best way to do it is to use the devel module.
Once you enable the module then go to blocks and enable the devel block on ur side bar.
Then refer to the red box in the image
http://cyrve.com/screenshots/devel_theme_snap-20080113-205127.jpg
It has an option for to clear the menu cache. The location of the block will depend on where you place the block.
If you have the Devel module installed, you can go to the menus configuration page (/admin/build/menu) and then select Devel menu.
Inside that page will appear a Rebuild menus options.
In D7, the menus configuration page has moved to admin/structure/menu/ .
This little trick is the great way to get the menu router to rebuild without cluttering up the UI with another block.
For the menu system, is there a way to set one of the menu items to be expanded by default? I can't get my home menu item to be expanded on the homepage (at the least), and I'd like it to be expanded whenever one of the other ones isn't.
I'm using Drupal 5, and the Taxonomy Menu module. Taxonomy Menu is pretty good with 95% of my pages, but some are static "About Us" type pages, which I'd like to have the home menu as default for, and then there's the homepage.
Well, I think I found a (sad) answer. From an issue on the Drupal webpage, "as it appears, the menu system of Drupal 5 is broken and won't be fixed anymore". So I'm finding a new way to do the top navigation that goes outside of Drupal's menu system.
Solution:
I ended up putting the navigation system in page.tpl.php. Based on the content of the nodes (I'm pulling the taxonomy from the breadcrumb), it chooses which one is highlighted, but defaults to home. It's hackier than I'd like, but it works.
/**
* Implementation of hook_menu_link_alter().
*
*/
function module_menu_link_alter(&$item, $menu) {
if($item['menu_name'] == 'primary-links') {
$item['expanded'] = 1;
}
}
It might be worth upgrading to Drupal 6 if you don't have too much invested in Drupal 5. Then all you have to do is administer the relevant menu and tick the "Expanded" option for it...