Changing bg color of div, on just one page
-
I want to change the background color of my navigation bar on one page only. I’m a newbie so please excuse me if this question is a dumb one.
I’m thinking I need to put a conditional statement in the page.php along with some css styling. I tried the coding below but it didn’t do anything. What am I doing wrong here besides everything? ??
1. div id to affect background color for nav is #access
2. using static home page: https://www.mydomain.com/home/Here is regular coding in my page.php
<?php /** * The template for displaying all pages. * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages * and that other 'pages' on your WordPress site will use a * different template. * * @package WordPress * @subpackage Twenty_Ten * @since Twenty Ten 1.0 */ get_header(); ?> <div id="container"> <div id="content" role="main"> <?php if ( is_front_page() ) { ?> <h2 class="entry-title"><?php the_title(); ?></h2> <?php } else { ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php } ?> <?php if (is_page(array('latest-news','news'))) { ?> <?php include('includes/news.php'); ?> <?php } ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-content --> </div><!-- #post-## --> <?php comments_template( '', true ); ?> <?php endwhile; ?> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); ?> <?php get_footer(); ?>
And here is the coding I tried to insert:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php if (is_page('home') ): // home ?> <style type="text/css"> #access {background: -moz-linear-gradient(center top , #FEFEFE 0%, #121212 100%) repeat scroll 0 0 transparent;} </style> <?php endif; // end the if, no background color change if not home ?>
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Changing bg color of div, on just one page’ is closed to new replies.