I tried to enqueue some styles on mobile only using wp_is_mobile()
function, but it always give me true, Here is the code (From functions.php
file) :
add_action('wp_enqueue_scripts','load_All_Styles'); // Set up styles
function load_All_Styles() {
wp_register_style('font-awesome',get_template_directory_uri().'/css/font-awesome.min.css',array(),false);
wp_register_style('preloader',get_template_directory_uri().'/css/preloader.css',array(),false);
wp_register_style('bootstrap',get_template_directory_uri().'/css/bootstrap.min.css',array(),false);
if(wp_is_mobile()){
wp_enqueue_style( 'font-awesome' );
}
if(is_front_page()) {
wp_enqueue_style( 'preloader' );
}
}
what method to use instead? Any Solutions?