Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Masahiro Yasuda
Masahiro Yasuda
25,702 Points

WordPress Template CSS .archive

Hello I am currently studying WordPress template by a textbook. And I want to set background color #fff on each articles from archives. but I am thinking if the textbook sample CSS is correct or not because it won't work if I don't comment out ".archive" what is ".archive" for on this css?

This is textbook sample link. And every user try to learn by making it step by step. http://pacific2.prime-strategy.co.jp/archives/category/column/

archive.php <?php get_header(); ?> <section id="contents"> <header class="page-header"> <h1 class="page-title"><?php single_cat_title(); ?></h1> </header> <div class="posts"> <?php if (have_posts()) : while (have_posts()) : the_post(); get_template_part('content-archive'); endwhile; endif; ?> </div> </section><!-- #contents end --> <?php get_sidebar(); ?> <?php get_footer(); ?>

content-archive.php <article <?php post_class(); ?>> <a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail('large_thumbnail', array('alt'=> the_title_attribute('echo=0'), 'title'=> the_title_attribute('echo=0'))); ?> </a> <header class="entry-header"> <time pubdate="pubdate" datetime="<?php the_time('Y-m-d'); ?>" class=" entry-date"><?php the_time(get_option('date_format')); ?></time> <h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> </header> <section class="entry-content"> <?php the_excerpt(); ?> </section> </article>

css /* column / / .archive */ article.hentry, .search article.hentry { background-color: #fff; padding: 20px; border-top: solid 1px #ddd; border-bottom: solid 1px #ddd; }

/* .archive */ article.hentry .attachment-large_thumbnail, .search article.hentry .attachment-large_thumbnail { background-color: #fff; padding: 4px; border: solid 1px #ddd; float: left; }

/* .archive / article.hentry .entry-header, / .archive */ article.hentry .entry-content, .search article.hentry .entry-header, .search article.hentry .entry-content { margin-left: 150px; }

/* .archive */ article.hentry time, .search article.hentry time { position: relative; top: -4px; }

span.author { font-size: 80%; display: block; float: right; }

/* .archive */ article h1, .search article h1 { font-size: 150%; font-weight: normal; line-height: 1; margin-bottom: 5px; }