Unlinks parent pages in page menus and lists. Useful for creating dropdown menus with top-level placeholders. Affects the output of wp_list_pages and …
IMPORTANT: This plugin is not compatible with the Mystique theme, nor is it compatible with the WordPress 3.x custom menu system (that is, menus created using the drag-and-drop menu builder under Appearance->Menus). If you want to create an unlinked parent menu item with the Mystique theme, install Mark Jaquith’s ‘Page Links To’ plugin, and put a ‘#’ (hash/pound) mark in the ‘Point to this URL:’ field to create a dummy link. For the WP3 menu builder, use a ‘Custom Link’ with a ‘#’ mark in the URL field. Refer to the documentation in the WP Codex if you need more help: https://codex.wordpress.org/Appearance_Menus_Screen#Custom_Links
When activated, this plugin unlinks parent pages (that is, pages that have child pages underneath them in a hierarchy) in page menus and lists. It affects the output of wp_list_pages and wp_page_menu, as well as all plugins and widgets that use those functions.
The plugin works by turning the parent page links into ‘dummy links’. That is, it replaces the href attribute on parent menu items with a ‘#’ (hash/pound) mark. A dummy link is just like a regular link, except that it leads back to the current page when clicked. The dummy links are given an inline style “cursor: default” to prevent the mouse pointer from turning into a hand when hovering over unlinked menu items.
To configure the plugin options, go to the Settings menu in the WordPress admin panel and click on ‘Unlink Parent Pages’.
Use Dummy Links
Turned on by default as of Unlink Parent Pages version 1.3. If you uncheck this box, the plugin will unlink the parent pages by replacing the anchor tags with span tags. In some themes, this may cause problems with CSS styling. In order to fix this, you would need to add an additional selector to any rule that targets the anchor tags (see the FAQ for more information). If you are not experienced in writing CSS selectors, then it is strongly recommended to stick with dummy links.
Unlink Current Page
Unlink the current page, in addition to the parent pages.
Remove Link Titles
Remove the title attribute from the links (stops the tooltip from popping up when the mouse hovers over the menu items). This doesn’t have anything to do with unlinking parent pages, but it’s something a lot of people want, so I decided to include it.
Maximum Depth
The maximum depth setting controls how many levels in the hierarchy of pages are to be unlinked. It works exactly like the ‘depth’ option for wp_list_pages, as follows:
Unlink Specific Pages
You can specify which pages you want unlinked, using a comma-separated list of page IDs (example: 3,7,31). It works exactly like the ‘exclude’ option for wp_list_pages. If you want only the specified pages to be unlinked, then set max depth to -1.
Unlink Parent Pages only affects the output of wp_list_pages and wp_page_menu. If your menu is not being generated by either of those functions, then the plugin will not work. If you want to test whether this is an issue with your menu, put the default ‘Pages’ widget into your sidebar. The Pages widget uses wp_list_pages, so if the pages are unlinked there, and not in your navigation menu, it means that your menu is not using wp_list_pages.
I know of two specific cases where this is a problem: the Mystique theme, and the WordPress 3.x custom menu system (that is, menus created using the drag-and-drop menu builder under Appearance->Menus). The WP 3.x custom menus are generated by the wp_nav_menu function, while the Mystique theme uses a non-standard custom function called mystique_list_pages. If Unlink Parent Pages detects either of these cases, it will display a warning message.
Unlink Parent Pages has been tested and is compatible with a number of other popular menu management plugins, including Page Menu Editor, Page Lists Plus, Page Links To, Sub Pages Widget, Exclude Pages, and All In One SEO Pack. It is probably compatible with most other plugins as well.
If you uncheck ‘Use Dummy Links’, the plugin will unlink the parent pages by replacing the anchor tags with span tags. In some themes, this may cause styling problems if there are CSS selectors targeting the anchor tags that have been removed. In order to fix this, you must add an additional selector to any rule that targets the anchor tags. The CSS rules are different for every theme, so I cannot give specific instructions. As a general example, if your menu styles look like this:
#menu li a { some styles ... }
Then you would need to add an additional selector which targets the span:
`#menu li span,
some styles …
}`
As an example, here are the rules that would need to be added to the bottom of ‘style.css’ in order to fix the Twenty Ten theme:
`#access span {
color: #aaa;
display: block;
line-height: 38px;
padding: 0 10px;
text-decoration: none;
}
background: #333;
line-height: 1em;
padding: 10px;
width: 160px;
height: auto;
}
background: #333;
color: #fff;
}`