<?php
/**
 * Enqueue scripts and styles.
 */
if ( ! function_exists( 'xarxaprod_theme_css_scripts' ) ){
  function xarxaprod_theme_css_scripts() {
    wp_enqueue_style( 'xarxaprod-style', get_stylesheet_uri(), array(), _S_VERSION );
    //https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2056
    //wp_enqueue_style('main-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/style.css'), false);
    //wp_enqueue_style( 'xarxaprod-style', get_stylesheet_uri(), array(), filemtime(get_stylesheet_uri() . 'style.css'), false);
    wp_style_add_data( 'xarxaprod-style', 'rtl', 'replace' );
  	
  	// https://stackoverflow.com/a/24994304 
    // deregister default jQuery included with Wordpress
    //wp_deregister_script( 'jquery' ); 
    // register our jQuery minified from theme directory
    //wp_enqueue_script('jquery', get_template_directory_uri().'/js/jquery.min.js', array(),'3.7.1',true);
  
    // navigation scripts
    wp_enqueue_script( 'xarxaprod-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );
  
  	// scroll detection script
    // https://css-tricks.com/styling-based-on-scroll-position/
    wp_enqueue_script( 'xarxaprod-scrollposition', get_template_directory_uri() . '/js/scrollposition.js', array(), _S_VERSION, true );
  	
  	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
      wp_enqueue_script( 'comment-reply' );
    }
	}
}
add_action( 'wp_enqueue_scripts', 'xarxaprod_theme_css_scripts' );
