php - CSS not linking to HTML Page Template -


i tried in localhost wordpress , works fine there.

but when try live website , try link css files html file not css effects.

i link css html file using following address location :

<link href="/wordpress/wp-content/themes/themename/file1.css" rel="stylesheet" /> 

how can possibly link css files html?

ps : linking html file php file create page template

require(templatepath.'/file1.html') 

also there no folder named wordpress in control panel directory. address location html , css file /home3/username/public_html/wp-content/themes/themename/file1.html

you shouldn't write full path in template. wordpress provide functions that, get_stylesheet_directory_uri returns uri of current theme folder. link css should this:

<link href="<?php echo get_stylesheet_directory_uri(); ?>/file1.css" media="all" rel="stylesheet" type="text/css" /> 

but should consider linking css functions.php it's better practice:

function my_scripts() {   wp_enqueue_style( 'my_style', get_stylesheet_directory_uri() . '/file1.css' ); } add_action( 'wp_enqueue_scripts', 'my_scripts' ); 

that way wordpress add <link> tag stylesheet in head when wp_head() called.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -