From 7fe9ffc7413110beaaefadaa586f1a275c173f61 Mon Sep 17 00:00:00 2001 From: "Jorge vitrubio.net" Date: Sun, 31 Mar 2024 14:41:36 +0200 Subject: [PATCH] moved call to script to inc, cleaner structure --- functions.php | 25 +------------------------ inc/theme-css-scripts.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 inc/theme-css-scripts.php diff --git a/functions.php b/functions.php index 0354081..81d133d 100644 --- a/functions.php +++ b/functions.php @@ -127,31 +127,8 @@ require get_template_directory() . '/inc/widgets-register.php'; /** * Enqueue scripts and styles. */ -function xarxaprod_theme_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_scripts' ); +require get_template_directory() . '/inc/theme-css-scripts.php'; /** * Implement the Custom Header feature. diff --git a/inc/theme-css-scripts.php b/inc/theme-css-scripts.php new file mode 100644 index 0000000..569ec2d --- /dev/null +++ b/inc/theme-css-scripts.php @@ -0,0 +1,31 @@ +