advantage_scripts_method

The Advantage advantage scripts method function.

Description

advantage_scripts_method(); 

Usage

  1. if ( !function_exists( 'advantage_scripts_method' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = advantage_scripts_method(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function advantage_scripts_method() {  
  2. global $advantage_options, $advantage_fonts; 
  3.  
  4. $theme_uri = get_template_directory_uri(); 
  5. // Check if the fonts are webfont, if yes, load the font. 
  6. $advantage_fonts = advantage_fonts_array(); 
  7. $font_elements = array( 
  8. 'bodyfont', 'headingfont', 'entrytitlefont',  
  9. 'sitetitlefont', 'sitedescfont', 'mainmenufont',  
  10. 'sidebarfont', 'widgettitlefont', 'footerfont' 
  11. ); 
  12. $fonts = array(); 
  13. foreach ( $font_elements as $element ) { 
  14. if ( $advantage_options[$element] > 0 
  15. && ! in_array( $advantage_options[ $element ], $fonts) ) 
  16. $fonts[] = $advantage_options[ $element ];  
  17.  
  18. foreach ( $fonts as $font ) { 
  19. if ( ! empty( $advantage_fonts[ $font ]['url'] ) ) 
  20. wp_enqueue_style( str_replace(' ', '', $advantage_fonts[ $font ]['label']), $advantage_fonts[ $font ]['url'], false, 1.0 ); 
  21.  
  22. wp_enqueue_style('bootstrap', $theme_uri . '/css/bootstrap.min.css', null, '2.3.1'); 
  23. wp_enqueue_style('fontawesome', $theme_uri . '/css/font-awesome.min.css', array( 'bootstrap' ), '3.0.2' ); 
  24. wp_enqueue_style('advantage', $theme_uri . '/dev/advantage.css', array( 'bootstrap', 'fontawesome' ), ADVANTAGE_VERSION); 
  25. $child_pre = array( 'advantage' ); 
  26. // Load Scheme CSS 
  27. if ( ! empty( $advantage_options['schemecss'] ) ) { 
  28. wp_enqueue_style('advantage-scheme', $advantage_options['schemecss'], $child_pre, ADVANTAGE_VERSION ); 
  29. $child_pre[] = 'advantage-scheme';  
  30. //Load child theme's style.css 
  31. if ( $theme_uri != get_stylesheet_directory_uri() ) 
  32. wp_enqueue_style('advantage-child', get_stylesheet_uri(), $child_pre, ADVANTAGE_VERSION ); 
  33.  
  34. // Page Template specific 
  35. if ( is_page_template( 'pages/portfolio.php' ) ) { 
  36. wp_enqueue_script( 'infinite-scroll' , $theme_uri . '/js/jquery.infinitescroll.min.js', array( 'jquery-masonry' ), '2.0', true );  
  37. $advantage_dep[] = 'infinite-scroll'; 
  38. }  
  39. //Scripts 
  40. if ( is_singular() && get_option( 'thread_comments' ) ) 
  41. wp_enqueue_script( 'comment-reply' );  
  42. wp_enqueue_script( 'modernizr' , $theme_uri . '/js/modernizr.custom.js', null ); 
  43. wp_enqueue_script( 'bootstrap' , $theme_uri . '/js/bootstrap.min.js', array( 'jquery'), '2.3.1', true ); 
  44. wp_enqueue_script( 'advantage' , $theme_uri . '/js/advantage.js', array( 'bootstrap'), ADVANTAGE_VERSION, true );