PageRenderTime 38ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/disable-parent-menu-link/disable-parent-menu-link.php

https://bitbucket.org/nlyn/mr.-peacocks
PHP | 37 lines | 28 code | 2 blank | 7 comment | 3 complexity | 16db7ced6f3c5241f8b6384bcd2bd6e1 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /*
  3. Plugin Name: Disable Parent Menu Link
  4. Description: A plugin which allows you to disable parent menu link created through wp_nav_menu function.
  5. Author: Kapil Chugh
  6. Plugin URI: http://www.mediologysoftware.com/wp-concierge/wp-concierge.html
  7. Version: 0.1.3
  8. */
  9. add_action('wp_footer', 'disable_parent_menu_link');
  10. function disable_parent_menu_link () {
  11. wp_print_scripts('jquery');
  12. ?>
  13. <script type="text/javascript">
  14. if (jQuery("ul (li.page_item):has(ul.children)").length > 0) {
  15. jQuery("ul (li.page_item):has(ul.children)").hover(function () {
  16. jQuery(this).children("a").removeAttr('href');
  17. jQuery(this).children("a").css('cursor', 'default');
  18. jQuery(this).children("a").click(function () {
  19. return false;
  20. });
  21. });
  22. }
  23. else if (jQuery("ul (li.menu-item):has(ul.sub-menu)").length > 0) {
  24. jQuery("ul (li.menu-item):has(ul.sub-menu)").hover(function () {
  25. jQuery(this).children("a").removeAttr('href');
  26. jQuery(this).children("a").css('cursor', 'default');
  27. jQuery(this).children("a").click(function () {
  28. return false;
  29. });
  30. });
  31. }
  32. </script>
  33. <?php
  34. }
  35. ?>