/wp-content/plugins/disable-parent-menu-link/disable-parent-menu-link.php
PHP | 37 lines | 28 code | 2 blank | 7 comment | 3 complexity | 16db7ced6f3c5241f8b6384bcd2bd6e1 MD5 | raw file
Possible License(s): GPL-2.0
- <?php
- /*
- Plugin Name: Disable Parent Menu Link
- Description: A plugin which allows you to disable parent menu link created through wp_nav_menu function.
- Author: Kapil Chugh
- Plugin URI: http://www.mediologysoftware.com/wp-concierge/wp-concierge.html
- Version: 0.1.3
- */
- add_action('wp_footer', 'disable_parent_menu_link');
- function disable_parent_menu_link () {
- wp_print_scripts('jquery');
- ?>
- <script type="text/javascript">
- if (jQuery("ul (li.page_item):has(ul.children)").length > 0) {
- jQuery("ul (li.page_item):has(ul.children)").hover(function () {
- jQuery(this).children("a").removeAttr('href');
- jQuery(this).children("a").css('cursor', 'default');
- jQuery(this).children("a").click(function () {
- return false;
- });
- });
- }
- else if (jQuery("ul (li.menu-item):has(ul.sub-menu)").length > 0) {
- jQuery("ul (li.menu-item):has(ul.sub-menu)").hover(function () {
- jQuery(this).children("a").removeAttr('href');
- jQuery(this).children("a").css('cursor', 'default');
- jQuery(this).children("a").click(function () {
- return false;
- });
- });
- }
- </script>
- <?php
- }
- ?>