How do you find this line of code?
-
Hi, I asked the support forum for my theme and he said to find this code and delete it, but I can’t seem to find it in my style.css or my header.php. Please help? Where can I find what he is saying?
It looks like at some point there was some css added to the head of the file. You’ll need to remove these lines to allow the styles.css to control the background color:
<style type=”text/css”>
body { background-color: #FFFFFF; }
</style>
-
It’s in a style block in the
<head>
section of your HTML, which almost certainly means you’ll find it in header.php.HTH
PAE
Hi peredur, I’ve checked my header.php but I still locate it. Would it be okay if I posted the header.php code here?
You need to use pastebin if it’s a lot of code.
Seems to me that there’s something injecting that style block into your header. So yes, if we can look at the code it might help, but I’ve a suspicion that it’s a plugin that’s injecting the code and so we won’t be able to see it. I guess it’ll be using the
wp_head()
hook and there’ll be nothing we can do about it.If it is a plugin it seems to me to be a really unsociable bit of code to inject into an HTML file. It effectively stops anything else from controlling the background.
You could disable your plugins one-by-one to try to find out which one’s doing it, assuming it is a plugin, and then get onto them to find what you need to alter to stop it.
In really desparate straits, if you know what color you want your background to be, you could hard code it into the
<body>
element. But that’s desparation indeed. And it wouldn’t be configurable, except by changing the code.HTH
PAE
Hi, I’ve deactivated all my plugins, but the background still remain the same. This is the code I put in my style.css:
body { background-color: #00FFFF; }
I’ve tried checking my header for the code that the guy mentioned above, but I still can’t find it. This is all the code in my header.php:
<?php global $linen; ?>
<!DOCTYPE html>
<html <?php language_attributes( ‘html’ ) ?>>
<head>
<?php if ( is_front_page() ) : ?>
<title>How To Focus Better</title>
<?php elseif ( is_404() ) : ?>
<title><?php bloginfo( ‘name’ ); ?></title>
<?php elseif ( is_search() ) : ?>
<title><?php printf(__ (“Search results for ‘%s'”, “linen”), get_search_query()); ?><?php bloginfo( ‘name’ ); ?></title>
<?php else : ?>
<title><?php wp_title($sep = ” ); ?><?php bloginfo( ‘name’ );?></title>
<?php endif; ?><!– Basic Meta Data –>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>” />
<meta name=”copyright” content=”<?php
esc_attr( sprintf(
__( ‘Design is copyright %1$s The Theme Foundry’, ‘linen’ ),
date( ‘Y’ )
) );
?>” /><!– Favicon –>
<link rel=”shortcut icon” href=”<?php echo get_stylesheet_directory_uri(); ?>/images/favicon.ico” /><!– WordPress –>
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>” />
<?php wp_head(); ?>
<script type=”text/javascript”>var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-21871265-1’]);
_gaq.push([‘_trackPageview’]);(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘https://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();</script>
</head>
<body <?php body_class(); ?>>
<div class=”skip-content”><?php _e( ‘Skip to content’, ‘linen’ ); ?></div>
<div id=”wrapper” class=”clear”>
<div id=”header” class=”clear”>
<?php if ($linen->logoState() == ‘true’ ) : ?>
<?php $upload_dir = wp_upload_dir(); ?>
<div id=”title-logo”>
“>
<img src=”<?php echo $linen->logoName(); ?>” alt=”<?php if ($linen->logoAlt() !== ” ) echo $linen->logoAlt(); else echo bloginfo( ‘name’ ); ?>” />
</div>
<?php if ($linen->logoTagline() == ‘true’ ) : ?>
<div id=”description”>
<h2><?php bloginfo( ‘description’ ); ?></h2>
</div><!–end description–>
<?php endif; ?>
<?php else : ?>
<?php if (is_home()) echo( ‘<h1 id=”title”>’ ); else echo( ‘<div id=”title”>’ );?>“><?php bloginfo( ‘name’ ); ?><?php if (is_home()) echo( ‘</h1>’ ); else echo( ‘</div>’ );?>
<div id=”description”>
<h2><?php bloginfo( ‘description’ ); ?></h2>
</div><!–end description–>
<?php endif; ?>
<?php
wp_nav_menu(
array(
‘theme_location’ => ‘nav-1’,
‘container_id’ => ‘navigation’,
‘container_class’ => ‘clear’,
‘menu_class’ => ‘nav’,
‘fallback_cb’ => array( &$linen, ‘main_menu_fallback’ )
)
);
?>
</div><!–end header–>
<?php if (($linen->sliderState() != ” ) && is_front_page() && !is_paged() ) { ?>
<?php get_template_part( ‘tmpart-featured’ ); ?>
<?php } ?>
<?php if (is_page_template( ‘tm-left-sidebar.php’ )) : ?>
<?php get_sidebar(); ?>
<?php endif; ?>
<div id=”content” <?php if ( ( is_page_template( ‘tm-no-sidebar.php’ ) ) || ( $linen->sidebarDisable() == ‘true’ ) ) echo ( ‘class=”no-sidebar”‘ ); ?>>Beats me. All of this:
<link rel="alternate" type="application/rss+xml" title="How To Focus Better » Feed" href="https://howtofocusbetter.com/feed/" /> <link rel="alternate" type="application/rss+xml" title="How To Focus Better » Comments Feed" href="https://howtofocusbetter.com/comments/feed/" /> <link rel='stylesheet' id='linen-style-css' href='https://howtofocusbetter.com/wp-content/themes/linen_pro_child/style.css' type='text/css' media='all' /> <!--[if lt IE 8]> <link rel='stylesheet' id='linen-ie-style-css' href='https://howtofocusbetter.com/wp-content/themes/linen_pro/stylesheets/ie.css' type='text/css' media='all' /> <![endif]--> <script type='text/javascript' src='https://howtofocusbetter.com/wp-includes/js/l10n.js?ver=20101110'></script> <script type='text/javascript' src='https://howtofocusbetter.com/wp-includes/js/comment-reply.js?ver=20090102'></script> <script type='text/javascript' src='https://howtofocusbetter.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script> <script type='text/javascript' src='https://howtofocusbetter.com/wp-content/themes/linen_pro/javascripts/linen.js'></script> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://howtofocusbetter.com/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://howtofocusbetter.com/wp-includes/wlwmanifest.xml" /> <link rel='index' title='How To Focus Better' href='https://howtofocusbetter.com/' /> <link rel='next' title='About Me' href='https://howtofocusbetter.com/about-me/' /> <meta name="generator" content="WordPress 3.2.1" /> <link rel='canonical' href='https://howtofocusbetter.com/' /> <style type="text/css"> body { background-color: #FFFFFF; } </style>
… is being produced by code using the wp_head() hook. As far as I know, that’s plugins.
We can easily override the style, but only to another fixed value. We can’t hand off control over the style to your theme.
Sorry. It beats me.
Cheers
PAE
- The topic ‘How do you find this line of code?’ is closed to new replies.