वर्णन
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.
Options
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:
- 0 (default) Unlinks all parent pages, anywhere in the page hierarchy.
- 1 Unlinks top-level parent pages only.
- 2, 3, … Unlinks parent pages to the given depth.
- -1 Do not unlink any pages (specify individual pages instead).
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.
स्क्रीनशॉट
स्थापना
- Upload ambrosite-unlink-parent-pages.php to the /wp-content/plugins/ directory.
- Activate the plugin through the Plugins menu in WordPress.
- Go to the Settings menu in the WordPress admin panel, and click on Unlink Parent Pages to configure the plugin options.
- All parent pages in menus created with either wp_list_pages or wp_page_menu will become unlinked as soon as the plugin is activated. It will also automatically unlink newly created parent pages as the page hierarchy is built.
नेहमी विचारले जाणारे प्रश्न
- I installed the plugin but it does not seem to be working. Why?
-
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.
- Is this plugin compatible with my favorite menu management plugin?
-
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.
- I do not want to use dummy links. How can I fix my menu styles when the parent pages are unlinked?
-
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,
- menu li a {
-
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;
} - access ul ul span {
-
background: #333;
line-height: 1em;
padding: 10px;
width: 160px;
height: auto;
} - access ul ul :hover > span {
-
background: #333;
color: #fff;
}`
समीक्षा
ह्या प्लगइनसाठी कोणतेही समीक्षण नाही.
योगदानकर्ते आणि विकसक
“Ambrosite Unlink Parent Pages” हे मुक्त स्रोत सॉफ्टवेअर आहे. पुढील लोक या प्लगइनच्या निर्मितीत योगदान केले आहे.
योगदानकर्तेभाषांतर करा “Ambrosite Unlink Parent Pages” तुमच्या भाषेत.
विकासातील आग्रह?
कोड ब्राउझ करा, SVN संग्रहालय तपासा, किंवा विकास लॉग च्या RSS द्वारे सदस्यता घ्या.
बदलांची यादी
1.4
- Fixed a bug that could potentially cause “undefined variable” and “headers already sent” warnings.
1.3
- Added option to unlink the current page.
- Added option to remove link titles.
- Dummy links turned on by default.
- Added inline style “cursor: default” to dummy links, to prevent the mouse pointer from turning into a hand when hovering over unlinked menu items.
- Added warning messages for Mystique theme and WP 3.x custom menus.
1.2
- Refactored to improve performance.
1.1
- Added option to unlink specific pages.
1.0
- Initial version.