html - Wordpress not working after adding style.css -
i have been trying find solution while no luck... busy making custom theme wordpress per this article. html , php hooks get_header() working try add style.css doesn't work , "demo theme" stuck on loading.however when remove works css in style.css file not loaded. these css files load page.
<link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/css/bootstrap.css" type="text/css" /> <link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/style.css" type="text/css" /> <link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/css/dark.css" type="text/css" /> <link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/css/font-icons.css" type="text/css" /> <link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/css/animate.css" type="text/css" /> <link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/css/magnific-popup.css" type="text/css" /> <link rel="stylesheet" href="http://www.website.com/wp-content/themes/canvas/css/responsive.css" type="text/css" />
how correctly load of these css files wordpress page. thanks! using following code
define("theme_dir", get_template_directory_uri()); /*--- remove generator meta tag ---*/ remove_action('wp_head', 'wp_generator'); // enqueue styles function enqueue_styles() { /** register css**/ wp_register_style( 'bootstrap', theme_dir . '/css/bootstrap.css', array(), '1', 'all' ); wp_register_style( 'dark', theme_dir . '/css/dark.css', array(), '1', 'all' ); wp_register_style( 'font-icons', theme_dir . '/css/font-icons.css', array(), '1', 'all' ); wp_register_style( 'animate', theme_dir . '/css/animate.css', array(), '1', 'all' ); wp_register_style( 'magnific-popup', theme_dir . '/css/magnific-popup.css', array(), '1', 'all' ); wp_register_style( 'responsive', theme_dir . '/css/responsive.css', array(), '1', 'all' ); //wp_register_style( 'style', theme_dir . '/style.css', array(), '1', 'all' ); /** enqueue css**/ wp_enqueue_style( 'bootstrap' ); wp_enqueue_style( 'dark' ); wp_enqueue_style( 'font-icons' ); wp_enqueue_style( 'animate' ); wp_enqueue_style( 'magnific-popup' ); wp_enqueue_style( 'responsive' ); //wp_enqueue_style( 'style' ); } add_action( 'wp_enqueue_scripts', 'enqueue_styles' ); // enqueue scripts function enqueue_scripts() { wp_register_script( 'html5-shim', 'http://html5shim.googlecode.com/svn/trunk/html5.js', array( 'jquery' ), '1', false ); wp_enqueue_script( 'html5-shim' ); wp_register_script( 'custom-script', theme_dir . '/js_path/customscript.js', array( 'jquery' ), '1', false ); wp_enqueue_script( 'custom-script' ); } add_action( 'wp_enqueue_scripts', 'enqueue_scripts' );
but isn't working... have checked wp_head() present in header file , php working ??? as add style.css gets stuck on loading
generally, idea use unique names stylesheet handles (see reference). wasn't able recreate error, try changing
wp_register_style( 'style', theme_dir . '/style.css', array(), '1', 'all' );
to
wp_register_style( 'unique-name-style', theme_dir . '/style.css', array(), '1', 'all' );
and
wp_enqueue_style( 'style' );
to
wp_enqueue_style( 'unique-name-style' );
Comments
Post a Comment