diamo
Forum Replies Created
-
To follow up my issue in case anyone else has this problem, I have at least identified where the body.custom-background exists and how it appears embedded into the index.php code. The custom background is actually defined as PHP code in a file called theme.php. It is located within the wordpress/wp-includes/ folder. In this file you will find a section of code at the bottom of this post that deals with the custom background. At the very bottom of the code below you will see the CSS rule in question defined as body.custom-background { <?php echo trim( $style ); ?> }. I don’t know how to write PHP code but I assume this is a function that is calling information from another file to define the background color.
Ideally, I’d like to know where this function is grabbing its information so I have a better understanding of changing the body.custom-background CSS rule, so if anyone cares to elaborate on this, it would be helpful in having a more complete answer to this problem.
But in my case, I was just frustrated that I could not get to the body.custom-background on the Dreamweaver Live Code view and did not know where the code was coming from. Well I have identified where the code is (as said above) and a fix is just to delete the body.custom-background style from the code. It fixes having to deal with it when customizing your site, but there are some things still left confused:
1. How is the PHP function code creating the CSS rule? (a matter of learning PHP)
2. Why, if you copy the twentyten theme folder to create a new custom theme folder, then activate this new custom theme folder, does wordpress ignore the style.css file and use the php embedded css rule in theme.php???? This happens even if you make a copy of the twentyten folder and do not modify any content with it!!The culprit code in theme.php:
/**
* Default custom background callback.
*
* @since 3.0.0
* @access protected
*/
function _custom_background_cb() {
// $background is the saved custom image, or the default image.
$background = get_background_image();// $color is the saved custom color.
// A default has to be specified in style.css. It will not be printed here.
$color = get_theme_mod( ‘background_color’ );if ( ! $background && ! $color )
return;$style = $color ? “background-color: #$color;” : ”;
if ( $background ) {
$image = ” background-image: url(‘$background’);”;$repeat = get_theme_mod( ‘background_repeat’, ‘repeat’ );
if ( ! in_array( $repeat, array( ‘no-repeat’, ‘repeat-x’, ‘repeat-y’, ‘repeat’ ) ) )
$repeat = ‘repeat’;
$repeat = ” background-repeat: $repeat;”;$position = get_theme_mod( ‘background_position_x’, ‘left’ );
if ( ! in_array( $position, array( ‘center’, ‘right’, ‘left’ ) ) )
$position = ‘left’;
$position = ” background-position: top $position;”;$attachment = get_theme_mod( ‘background_attachment’, ‘scroll’ );
if ( ! in_array( $attachment, array( ‘fixed’, ‘scroll’ ) ) )
$attachment = ‘scroll’;
$attachment = ” background-attachment: $attachment;”;$style .= $image . $repeat . $position . $attachment;
}
?>
<style type=”text/css” id=”custom-background-css”>
body.custom-background { <?php echo trim( $style ); ?> }
</style>Cool. Google Chrome Console lets me see the code, but now how do I figure out where on my computer that code actually is? I right-click on the background element because I am interested in changing the background-color css rule, and I choose Inspect Element. And I see the <body> tag and the related css on the right panel as in this Jpeg A
I am after the culprit css rule body.custom-background. This is the code I want to find in my files and change, but I cannot as I described in my first post. I see this body.custom-background css on rule on the right, I can change the property of the rule, which is cool. But then how do I know where that piece of code actually is in my files? I see there is a link next to the rule /explore_ca/blog/:15 so I click on it and it takes me to the CSS rule in some code, see Jpeg B, which looks exactly like the code I see when I view the page in Dreamweaver using Live Code (Jpeg 3). So how can I understand Google Console to tell me exactly which file I will be able to open up and see that css rule and it is not hidden inside some php code where I need Live Code to view?
Thanks for helping me with this potentweb.I am running a testing server through MAMP. So the site isn’t live. I am not familiar with google chrome and how it could solve my problem, but I’ll look into your suggestion. Cheers.