0

Hi I recently started to learn wordpress theme development and today I started my first worpress theme.For some reason my stylesheet get's loaded in chrome but not in firefox and IE the browsers I am using to test.

Something else I noticed is that it seems wordpress adds some additional styles on its own.Here's what I found on the source page:

<style type="text/css" media="screen">
html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }
 </style>

This are not styles I added.

I have tryed to use <?php echo get_stylesheet_uri() ?>

                 <?php bloginfo('stylesheet_url')

But none of theme seem to load the styles.

Here is my entire header code:

   <!DOCTYPE html>
   <html lang="en">
   <head>
   <meta charset="utf-8">
   <title>
       <?php if (is_home () ) { bloginfo('name'); }elseif ( is_category() ) { single_cat_title(); echo ' - ' ; bloginfo('name'); }
            elseif (is_single() ) { single_post_title();}
            elseif (is_page() ) { bloginfo('name'); echo ': '; single_post_title();}
            else { wp_title('',true); } 
       ?>
   </title>
   <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="<?php bloginfo('html_type') ?>" media="screen"/>
   <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" type ="<?php bloginfo('html_type') ?>" />
   <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
   <![endif]-->
   <?php wp_head() ?>
</head>

1 Answer 1

1

Something else I noticed is that it seems wordpress adds some additional styles on its own.Here's what I found on the source page:

When you browse your blog while logged in, wordpress adds 28px margin to top of html/body to make space for their - Wordpress Toolbar

And here's line of code from my theme which is correctly loading stylesheet -

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
6
  • well it seems that this style is being added to my index.php file.This should not happen right? Aug 13, 2012 at 12:22
  • it solved the problem of adding the stylesheet but it still still adds the aditional css with from what I know it should not be added on the theme file isen't that true? Aug 13, 2012 at 12:24
  • if you don't want to show admin mar you can disable it.
    – Amit Kosti
    Aug 13, 2012 at 12:25
  • @user985482 That 28px margin is correctly being added, if that's what you're asking. Aug 13, 2012 at 12:26
  • Administration > Users > Your Profile and turn of admin bar to not add those extra stylesheet.
    – Amit Kosti
    Aug 13, 2012 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.