PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Oct 19, 2019 2:30 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Mar 31, 2016 5:47 pm 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
I was just going through this tutorial and basically the author recommends that the css stylesheet be imported like so:

Syntax: [ Download ] [ Hide ]
<?php
    function learningWordPress_resources() {
        wp_enqueue_style('style' , get_stylesheet_uri());
    }
    add_action('wp_enqueue_scripts' , 'learningWordPress_resources');
?>
 


My header.php of my theme looks like so:

Syntax: [ Download ] [ Hide ]
<!doctype html>
<html <?php  language_attributes(); ?> >
    <head>
        <meta charset="<?php  bloginfo('charset');   ?>">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title><?php bloginfo('name');  ?></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">        

        <?php  wp_head(); ?>

    </head>
    <body <?php  body_class(); ?>>



    <header class="site-header">
        <h1><a href="<?php echo home_url(); ?>"></a><?php bloginfo('name');  ?></h1>
        <h5><?php bloginfo('description'); ?></h5>
    </header>
 


But i am still not seeing the effect of my stylesheet , can anybody point me to what exactly am i doing wrong ?

Thank you.


Top
 Profile  
 
PostPosted: Sun Apr 03, 2016 5:33 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
EDIT:: On further inspection i found out that if i post the contents of header.php in index.php the stylesheet is loading fine , which means that my functions.php files is working fine. So i guess the problem is with my header.php file, I have updated above what my header.php file looks like, so can somebody tell me whats wrong with my header.php file now ?


Top
 Profile  
 
PostPosted: Sun Apr 03, 2016 7:27 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada

_________________


Top
 Profile  
 
PostPosted: Tue Apr 05, 2016 9:23 pm 
Offline
Forum Commoner

Joined: Thu Jul 24, 2008 12:06 pm
Posts: 29
does your index.php file have something like this

Syntax: [ Download ] [ Hide ]
get_header();
 


if not, it needs it. Place that line of text at the very top of your index.php file before anything else and that should solve it. Also make sure that your index file has one for the footer

Syntax: [ Download ] [ Hide ]
get_footer();
 

placed at the very end of the index.php file


Top
 Profile  
 
PostPosted: Sun Apr 10, 2016 12:01 pm 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
@celauran and @cybershot , you guys were right , i found out that i was missing the following:

get_header();


Top
 Profile  
 
PostPosted: Fri Apr 15, 2016 10:10 am 
Offline
Forum Newbie

Joined: Fri Apr 15, 2016 10:03 am
Posts: 1
Use <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" /> and then @import the additional stylesheets at the top of style.css after the theme data block.


Last edited by Celauran on Fri Apr 15, 2016 10:11 am, edited 1 time in total.
Removed link spam. Don't do that again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group