• I used the automated custom header image panel to try out an image which I no longer want (I edited the style sheet directly). Now I have some css that is generated in the head of the html document, and I would like to get rid of that embedded style. I’ve hunted around a bit, and found some promising things on the functions.php page, but wasn’t sure where to find and kill that style.

    Thank you for any advice!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you, by chance, using the default template?

    If so, please open header.php and look for this block of code that starts on line 13:

    <style type="text/css" media="screen">
    
    <?php
    // Checks to see whether it needs a sidebar or not
    if ( !empty($withcomments) && !is_single() ) {
    ?>
    	#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
    <?php } else { // No sidebar ?>
    	#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
    <?php } ?>
    
    </style>

    Deleting this lines will delete the styles.

    If you are not using the default theme, please let me know which theme you are using.

    Thread Starter snowflakey

    (@snowflakey)

    No, I’m adapting from techland-10, but doing some significant re-working (ditched the stylesheet and have been doing some reorganizing of the template files). Just trying to find the php that is causing an embedded style to be written. I’ve adapted my styles so that they don’t conflict, but it looks untidy and I want to know how to be rid of it.

    This is what is written to the head of my html doc:

    <style type="text/css">
    
      #header {
    	margin: 0 auto;
    	width: 900px;
    	height:180px;
    	background: url(--edited by snowflakey to remove url--) no-repeat center;
      }
      #header *
      {
    	color: #000;
      }
    </style>

    This isn’t even what is on my current style sheet, although it was when I used the custom image header editor.

    Ok, I think I got it.
    On line 36 of the techland-10 theme, you will find the following code:

    function theme_header_style() {
    ?>
    <style type="text/css">
    
      #header {
    	margin: 0 auto;
    	width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
    	height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;
    	background: url(<?php header_image(); ?>) no-repeat center;
      }
      #header *
      {
    	color: #<?php header_textcolor();?>;
      }
    </style>
    <?php
    }
    if ( function_exists('add_custom_image_header') ) {
    	add_custom_image_header('theme_header_style', 'theme_admin_header_style');
    }

    Delete every line of it and you should have a css free <head> section. I tested this on my local install and it worked perfectly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting rid if embedded style in head’ is closed to new replies.