Guest User

css_js

a guest
Oct 10th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.79 KB | None | 0 0
  1. <?php
  2. function enigma_scripts() {    
  3.  
  4.         /* Main CSS libraries */
  5.         wp_enqueue_style('bootstrap', get_template_directory_uri() .'/css/bootstrap.css');
  6.         wp_enqueue_style('enigma-default', get_template_directory_uri() . '/css/default.css');
  7.         wp_enqueue_style('enigma-theme', get_template_directory_uri() . '/css/enigma-theme.css');
  8.         wp_enqueue_style('enigma-media-responsive', get_template_directory_uri() . '/css/media-responsive.css');
  9.         wp_enqueue_style('enigma-animations', get_template_directory_uri() . '/css/animations.css');
  10.         wp_enqueue_style('enigma-theme-animtae', get_template_directory_uri() . '/css/theme-animtae.css');
  11.  
  12.         /* Font awesome library */
  13.        
  14.         wp_enqueue_style('fontawesome-all', get_template_directory_uri() . '/css/font-awesome-5.11.2/css/all.css');
  15.  
  16.         wp_enqueue_style('enigma-style-sheet', get_stylesheet_uri());
  17.  
  18.         /* Web Fonts */    
  19.         wp_enqueue_style('enigma-google-fonts',esc_url(enigma_fonts_url()));
  20.  
  21.  
  22.                
  23.         // Js
  24.         wp_enqueue_script('popper', get_template_directory_uri() .'/js/popper.js', array('jquery'), true, true );
  25.         wp_enqueue_script('bootstrap-js', get_template_directory_uri() .'/js/bootstrap.js', array('jquery'), true, true );
  26.        
  27.        
  28.         /*Carofredsul Slides*/
  29.         wp_enqueue_script('jquery.carouFredSel', get_template_directory_uri() .'/js/carouFredSel-6.2.1/jquery.carouFredSel-6.2.1.js', array('jquery'), true, true );
  30.         if ( is_front_page() ) {
  31.                
  32.             /*PhotoBox JS*/
  33.             wp_enqueue_script('photobox-js', get_template_directory_uri() .'/js/jquery.photobox.js', array('jquery'), true, true );
  34.             wp_enqueue_style('photobox', get_template_directory_uri() . '/css/photobox.css');
  35.  
  36.                 //Footer JS//
  37.             wp_enqueue_script('enigma-footer-script', get_template_directory_uri() .'/js/enigma-footer-script.js', array('jquery'), true, true );
  38.         }
  39.         wp_enqueue_script('waypoints', get_template_directory_uri() .'/js/waypoints.js', array('jquery'), true, true );
  40.         wp_enqueue_script('enigma-scroll', get_template_directory_uri() .'/js/scroll.js', array('jquery'), true, true );
  41.         wp_enqueue_script( 'enigma-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), true, true );
  42.          wp_enqueue_script('enigma-theme-script', get_template_directory_uri() .'/js/enigma_theme_script.js', array('jquery'), true, true );
  43.          wp_enqueue_script('enigma-menu', get_template_directory_uri() .'/js/menu.js', array('jquery'), true, true );
  44.        
  45.         if ( is_singular() ) wp_enqueue_script( "comment-reply" );
  46.  
  47.         $image_speed = get_theme_mod('slider_image_speed' );
  48.         if ( ! empty ( $image_speed ) ) {
  49.             $image_speed = absint(get_theme_mod( 'slider_image_speed', '2000' ));
  50.             $speed       = true;
  51.         } else {
  52.             $image_speed = '';
  53.             $speed       = false;
  54.         }
  55.  
  56.         $ajax_data = array(
  57.             'blog_speed'  => absint(get_theme_mod( 'blog_speed', '2000' )),
  58.             'autoplay'    => absint(get_theme_mod( 'autoplay', 1 )),
  59.             'image_speed' => absint(get_theme_mod( 'slider_image_speed', '2000' )),
  60.             'speed'       => $speed,
  61.         );
  62.  
  63.         wp_enqueue_script( 'enigma-ajax-front', get_template_directory_uri() . '/js/enigma-ajax-front.js', array( 'jquery' ), true, true );
  64.         wp_localize_script( 'enigma-ajax-front', 'ajax_admin', array(
  65.             'ajax_url'      => admin_url( 'admin-ajax.php' ),
  66.             'admin_nonce'   => wp_create_nonce( 'admin_ajax_nonce' ),
  67.             'ajax_data'     => $ajax_data,
  68.         ) );
  69. }
  70. add_action('wp_enqueue_scripts', 'enigma_scripts');
  71.  
  72. if ( ! function_exists( 'enigma_fonts_url' ) ) :
  73.     /**
  74.      * Register Google fonts.
  75.      *
  76.      * Create your own enigma_fonts_url() function to override in a child theme.
  77.      *
  78.      * @since league 1.0
  79.      *
  80.      * @return string Google fonts URL for the theme.
  81.      */
  82.     function enigma_fonts_url()
  83.     {
  84.         $fonts_url = '';
  85.         $fonts     = array();
  86.  
  87.         if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'enigma' ) )
  88.         {
  89.             $fonts[] = 'Open+Sans:600,700';
  90.         }
  91.         if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'enigma' ) )
  92.         {
  93.             $fonts[] = 'Roboto:700';
  94.         }
  95.         if ( 'off' !== _x( 'on', 'Raleway font: on or off', 'enigma' ) )
  96.         {
  97.             $fonts[] = 'Raleway:600';
  98.         }
  99.        
  100.  
  101.         if ( $fonts ) {
  102.             $fonts_url = add_query_arg( array(
  103.                 'family' => urlencode( implode( '|', $fonts ) ),
  104.             ), 'https://fonts.googleapis.com/css' );
  105.         }
  106.  
  107.         return esc_url_raw( $fonts_url );
  108.     }
  109. endif;
Add Comment
Please, Sign In to add comment