Skip to content

Commit

Permalink
Section listing styled
Browse files Browse the repository at this point in the history
  • Loading branch information
blutz committed Aug 17, 2012
1 parent 399bbba commit 9d45bc5
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 51 deletions.
59 changes: 41 additions & 18 deletions archive.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<div id="content" class="<?php echo CONTAINER_CLASSES; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo MAIN_CLASSES; ?>" role="main">
<div class="row" id="archive-content">
<div class="span8" id="post-listing">
<div class="page-header">
<h1>
<?php
Expand All @@ -26,19 +24,44 @@
}
?>
</h1>
</div>
<?php roots_loop_before(); ?>
</div><!-- end div.page-header -->
<?php get_template_part('loop', 'category'); ?>
<?php roots_loop_after(); ?>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo SIDEBAR_CLASSES; ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<?php get_sidebar(); ?>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
</div><!-- end div#post-listing -->



<aside class="span4" id="sidebar" role="complementary">
<div id="sidebar-inside">
<div class="visible-desktop" id="side-ad">
<!-- <iframe id='a1b65622' name='a1b65622' src='http://www.oncampusweb.com/delivery/afr.php?zoneid=162&amp;cb=893274237927328048530' framespacing='0' frameborder='no' scrolling='no' width='300' height='250'><a href='http://www.oncampusweb.com/delivery/ck.php?n=a04df0d6&amp;cb=893274237927328048530' target='_blank'><img src='http://www.oncampusweb.com/delivery/avw.php?zoneid=162&amp;cb=893274237927328048530&amp;n=a04df0d6' border='0' alt='' /></a></iframe> -->
<img class="ad visible-desktop" src="http://placehold.it/300x250&text=ADVERTISEMENT" />
</div>


<div id="sidebar-popular">
<div class="side-head">
<h2><a href="#" id="popular-select" class="activetab" data-target="side-info-popular"><i class="ticon-eye"></i>Popular</a> <a href="#" id="commented-select" data-target="side-info-commented"><i class="ticon-personchat"></i>Most commented</a><br style="display:block;float:left;clear:both" /></h2>
</div><!-- end div.side-head -->
<div class="side-info" id="side-info-popular">
<?php wpp_get_mostpopular('limit=5&range="weekly"&pages=0&wpp_start="<ul class=\'side-popularlist\' id=\'side-popularlist-popular\'>"&wpp_end="</ul>"&order_by="views"&do_pattern=1&pattern_form="{image} {title} {stats} Comment(s)"&thumbnail_selection="usergenerated"'); ?>
</div>
<div class="side-info" id="side-info-commented">
<ul id="side-commented">
<?php
// From http://stackoverflow.com/questions/3328560/how-to-sort-posts-by-views-comments-rating-etc-wordpress
global $wpdb;
$most_commented = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts WHERE post_type='post' AND post_status = 'publish' ORDER BY comment_count DESC LIMIT 0 , 5");
foreach ($most_commented as $post) : setup_postdata($post); ?>
<li><a href="<?php echo get_permalink($post->ID); ?>"><?php the_title(); ?></a> <?php comments_number('0 Comments','1 Comment','% Comments'); ?></li>
<?php endforeach; ?>
</ul>
</div><!-- end div#side-info-commented -->

</div><!-- end div#sidebar-popular -->

</div><!-- end div#sidebar-inside -->
</aside><!-- end aside#sidebar -->


</div><!-- end div#archive-content -->
<?php get_footer(); ?>
42 changes: 42 additions & 0 deletions css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Author:
========================================================================== */

span.nameplate-date-weather {
display:none !important;
}


p {
margin: 0 0 15px;
}
Expand Down Expand Up @@ -1208,6 +1213,43 @@ span.copyright {
margin-left:0;
}

/* ===== Archive listing ========================================================
Author:
========================================================================== */

.page-header {
margin-top: 5px;
}
.page-header h1 {
text-align: right;
opacity: 0.5;
}
.title-category {
float:right;
}
.title-category a {
color:#AAA;
font-style:italic;
}
.articlelist-head > h2 {
font-weight: normal;
line-height: 1.3em;
padding-bottom: 7px;
}
.articlelist-head > h2 a {
color:#333;
}
.category-thumb {
float: left;
margin: 0 10px 10px 0;
clear:left;
}
#post-listing > article {
overflow: hidden;
border-bottom: 2px solid #AAA;
margin-bottom:7px;
}

/* ===== Audio player ========================================================
Author:
========================================================================== */
Expand Down
10 changes: 8 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ function roots_setup() {

// Add post thumbnails (http://codex.wordpress.org/Post_Thumbnails)
add_theme_support('post-thumbnails');
// set_post_thumbnail_size(150, 150, false);
// add_image_size('category-thumb', 300, 9999); // 300px wide (and unlimited height)
set_post_thumbnail_size(150, 150, false);
add_image_size( 'db-category-thumb', 300, 300 ); // 300px wide (and unlimited height)
add_image_size( 'db-front', 100, 100, 1 );
add_image_size( 'db-rotator', 670, 480, 1 );
add_image_size( 'db-category-full', 670, 670);
add_image_size( 'db-multimedia', 476, 300, 1 );
add_image_size( 'db-multimedia-small', 210, 140, 1 );


// Add post formats (http://codex.wordpress.org/Post_Formats)
// add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));
Expand Down
6 changes: 0 additions & 6 deletions inc/custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,6 @@ function dequeue_polls_style() {
wp_dequeue_style('wp-polls');
}

// Set image sizes
add_image_size( 'db-front', 100, 100, 1 );
add_image_size( 'db-rotator', 670, 480, 1 );
add_image_size( 'db-multimedia', 476, 300, 1 );
add_image_size( 'db-multimedia-small', 210, 140, 1 );


// Remove default WordPress Popular Posts stylesheet
add_action('wp_head', 'remove_wpp_stylesheet', 1);
Expand Down
10 changes: 1 addition & 9 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<?php get_header(); ?>
<?php roots_content_before(); ?>
<?php get_header(); ?>BLOOP
<div id="content" class="<?php echo CONTAINER_CLASSES; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo MAIN_CLASSES; ?>" role="main">
<div class="page-header">
<h1><?php _e('Latest Posts', 'roots');?></h1>
</div>
<?php get_template_part('loop', 'index'); ?>
</div><!-- /#main -->
<?php roots_main_after(); ?>
<?php roots_sidebar_before(); ?>
<aside id="sidebar" class="<?php echo SIDEBAR_CLASSES; ?>" role="complementary">
<?php roots_sidebar_inside_before(); ?>
<?php get_sidebar(); ?>
<?php roots_sidebar_inside_after(); ?>
</aside><!-- /#sidebar -->
<?php roots_sidebar_after(); ?>
</div><!-- /#content -->
<?php roots_content_after(); ?>
<?php get_footer(); ?>
2 changes: 2 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ $(document).ready(function() {
$(document).ready(function() {
if($(window).width() >= 980) {
var heightOfArticle = Math.max($('#sidebar').height(), $('article.post').height());
if($('#post-listing').height())
heightOfArticle = Math.max($('#post-listing').height()-10, heightOfArticle);
$('#sidebar').attr('style','height:'+heightOfArticle+'px');
}
});
Expand Down
2 changes: 1 addition & 1 deletion loop-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h1 class="entry-title"><?php the_title(); ?></h1>
<h2 class="subhead"><?php $subhead = get_post_custom_values('db_subhead'); echo $subhead[0]; ?></h2>
<?php if(has_post_thumbnail()) : ?>
<?php the_post_thumbnail('db-rotator'); ?>
<?php the_post_thumbnail('db-category-full'); ?>
<span class="photocredit photocredit-single"><?php the_media_credit_html(get_post_thumbnail_id($post->ID)); ?></span>
<span class="photocaption"><?php echo get_post(get_post_thumbnail_id($post->ID))->post_excerpt; ?></span>
<?php endif; ?>
Expand Down
32 changes: 17 additions & 15 deletions loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,29 @@
<?php } ?>

<?php /* Start loop */ ?>
<?php $firstArticle = true; ?>
<?php while (have_posts()) : the_post(); ?>
<?php roots_post_before(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php roots_post_inside_before(); ?>
<header>
<?php if($firstArticle): ?>
<?php if(has_post_thumbnail()): ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'db-category-full' ); ?></a>
<?php endif; ?>
<?php $firstArticle = false; ?>
<?php else : ?>
<?php if(has_post_thumbnail()): ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'db-category-thumb', array('class'=>'category-thumb') ); ?></a>
<?php endif; ?>
<?php endif; ?>

<header class="articlelist-head">
<span class="title-category"><?php the_category(' > ','single' );?></span>
<span class="timestamp"><?php the_time('F n, Y'); ?></span>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php roots_entry_meta(); ?>
</header>
<div class="entry-content">
<?php if (is_archive() || is_search()) { ?>
<?php the_excerpt(); ?>
<?php } else { ?>
<?php the_content(); ?>
<?php } ?>
</div>
<footer>
<?php $tags = get_the_tags(); if ($tags) { ?><p><?php the_tags(); ?></p><?php } ?>
</footer>
<?php roots_post_inside_after(); ?>
<?php the_audio(); ?>
<p><?php echo get_the_excerpt(); ?> <a href="<?php the_permalink(); ?>">More &raquo;</a></p>
</article>
<?php roots_post_after(); ?>
<?php endwhile; /* End loop */ ?>

<?php /* Display navigation to next/previous pages when applicable */ ?>
Expand Down

0 comments on commit 9d45bc5

Please sign in to comment.