Hi guys. I need some help with a wpml issue, it's driving me crazy. I have a website that it's translated into 5 languages and I need to load different style.css files for 2 of those languages. The other can keep using the main style.css. The problem is I don't know how to do that, and what I found online doesn't seem to work or I'm not doing it properly.
From what I understand, there are 2 ways to do this, either via modifying header.php or the theme's functions.php (I would rather use this one). I've created the different css files and named them style-it.css and style-de.css, but I cannot figure out what to add to the functions file...
Here's how the styles and scripts section looks on my functions.php file:
Question
TDT
Hi guys. I need some help with a wpml issue, it's driving me crazy. I have a website that it's translated into 5 languages and I need to load different style.css files for 2 of those languages. The other can keep using the main style.css. The problem is I don't know how to do that, and what I found online doesn't seem to work or I'm not doing it properly.
From what I understand, there are 2 ways to do this, either via modifying header.php or the theme's functions.php (I would rather use this one). I've created the different css files and named them style-it.css and style-de.css, but I cannot figure out what to add to the functions file...
Here's how the styles and scripts section looks on my functions.php file:
Start load theme CSS and scripts */ function load_theme_styles() { wp_register_style( 'style', get_template_directory_uri() . '/css/style.css', null, null, 'all' ); wp_enqueue_style( 'style' ); wp_register_style( 'jquery-fancybox', get_template_directory_uri() . '/js/libs/fancybox/jquery.fancybox-1.3.4.css"', null, null, 'all' ); wp_enqueue_style( 'jquery-fancybox' ); } function load_theme_scripts() { wp_enqueue_script( 'modernizr', get_template_directory_uri() .'/js/libs/modernizr-1.7.min.js', false, null, false ); wp_deregister_script( 'jquery' ); $url = 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'; // the URL to check against $test_url = @fopen( $url,'r' ); // test parameters if( $test_url != null ) { wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', false, '1.5.1', false ); } else { wp_register_script( 'jquery', get_template_directory_uri() .'/js/libs/jquery-1.5.1.min.js', __FILE__, false, '1.5.1', false ); } wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery-color' ); wp_enqueue_script( 'jquery-cycle', get_template_directory_uri() .'/js/libs/jquery.cycle.min.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'jquery-mousewheel', get_template_directory_uri() .'/js/libs/fancybox/jquery.mousewheel-3.0.4.pack.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'jquery-fancybox', get_template_directory_uri() .'/js/libs/fancybox/jquery.fancybox-1.3.4.pack.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'jquery-quote_rotator', get_template_directory_uri() .'/js/libs/jquery.quote_rotator.js', array( 'jquery' ) , null, true ); wp_enqueue_script( 'script', get_template_directory_uri() .'/js/script.js', array( 'jquery' ), null, true ); } add_action( 'wp_enqueue_scripts', 'load_theme_styles' ); add_action( 'wp_enqueue_scripts', 'load_theme_scripts' ); /* End load theme CSS and scripts
Any help would be much appreciated. Thank you!
Link to comment
https://www.neowin.net/forum/topic/1302468-wpml-css/Share on other sites
0 answers to this question
Recommended Posts