functions.php 1014 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. exit; // disable direct access
  4. }
  5. /**
  6. * Append integration CSS
  7. */
  8. function megamenu_twentyseventeen_style($scss) {
  9. $path = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'style.scss';
  10. $contents = file_get_contents( $path );
  11. return $scss . $contents;
  12. }
  13. add_filter( 'megamenu_load_scss_file_contents', 'megamenu_twentyseventeen_style', 9999 );
  14. /**
  15. * TwentySeventeen JavaScript helper
  16. */
  17. function megamenu_twentyseventeen_script() {
  18. wp_enqueue_script( "megamenu-twentyseventeen", plugins_url( 'script.js' , __FILE__ ), array('megamenu'), MEGAMENU_VERSION, true );
  19. }
  20. add_action( 'wp_enqueue_scripts', 'megamenu_twentyseventeen_script', 999 );
  21. /**
  22. * Restore menu-item class on menu items. Required for the sticky menu to work.
  23. */
  24. function megamenu_twentyseventeen_add_menu_item_class($classes) {
  25. $classes[] = 'menu-item';
  26. return $classes;
  27. }
  28. add_filter( 'megamenu_nav_menu_css_class', 'megamenu_twentyseventeen_add_menu_item_class', 9999 );