Skip to content

Commit

Permalink
Modified comment output to a simpler structure. Added some js so I could
Browse files Browse the repository at this point in the history
avoid duplicating twitter bs styles in styles.css.
  • Loading branch information
chrisbarnes committed Dec 31, 2011
1 parent 08436c6 commit 9173626
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 40 deletions.
67 changes: 48 additions & 19 deletions functions.php
Expand Up @@ -88,29 +88,28 @@ function bones_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<article id="comment-<?php comment_ID(); ?>" class="clearfix">
<header class="comment-author vcard row clearfix">
<div class="comment-author vcard row clearfix">
<div class="avatar span2">
<?php echo get_avatar($comment,$size='75',$default='<path_to_url>' ); ?>
</div>
<?php printf(__('<h4 class="span8">%s</h4>'), get_comment_author_link()) ?>

<?php edit_comment_link(__('Edit'),'<span class="edit-comment btn small info">','</span>') ?>
</header>
<?php if ($comment->comment_approved == '0') : ?>
<div class="alert-message success">
<p><?php _e('Your comment is awaiting moderation.') ?></p>
</div>
<?php endif; ?>
<div class="row">
<section class="comment_content span8 offset2 clearfix">
<?php comment_text() ?>
</section>
<div class="span8">
<?php printf(__('<h4 class="span8">%s</h4>'), get_comment_author_link()) ?>
<?php edit_comment_link(__('Edit'),'<span class="edit-comment btn small info">','</span>') ?>

<?php if ($comment->comment_approved == '0') : ?>
<div class="alert-message success">
<p><?php _e('Your comment is awaiting moderation.') ?></p>
</div>
<?php endif; ?>

<?php comment_text() ?>

<time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time('F jS, Y'); ?> </a></time>

<!-- removing reply link on each comment since we're not nesting them -->
<?php //comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>

<footer>
<time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time('F jS, Y'); ?> </a></time>
</footer>
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</article>
<!-- </li> is added by wordpress automatically -->
<?php
Expand Down Expand Up @@ -162,4 +161,34 @@ function wp_tag_cloud_filter($return, $args)
return '<div id="tag-cloud">'.$return.'</div>';
}

/*************************** shortcodes ************************************/

/* gallery shortcode */

// remove the standard shortcode
remove_shortcode('gallery', 'gallery_shortcode');
add_shortcode('gallery', 'gallery_shortcode_tbs');

function gallery_shortcode_tbs($attr) {
global $post, $wp_locale;

$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
$output = '<ul class="media-grid">';
foreach ( $attachments as $attachment ) {
$output .= '<li>';
$att_title = apply_filters( 'the_title' , $attachment->post_title );
$output .= wp_get_attachment_link( $attachment->ID , 'thumbnail', true );
$output .= '</li>';
}
$output .= '</ul>';
}

return $output;
}




?>
17 changes: 13 additions & 4 deletions library/js/scripts.js
Expand Up @@ -33,7 +33,7 @@ function addTwitterBSClass(thisObj) {
var titles = title.split(' ');
if (titles[0]) {
var num = parseInt(titles[0]);
if (num == 1)
if (num > 0)
$(thisObj).addClass('label');
if (num == 2)
$(thisObj).addClass('label notice');
Expand All @@ -45,12 +45,11 @@ function addTwitterBSClass(thisObj) {
$(thisObj).addClass('label important');
}
}
else
$(thisObj).addClass('label');
return true;
}




// as the page loads, cal these scripts
$(document).ready(function() {

Expand All @@ -59,5 +58,15 @@ $(document).ready(function() {
addTwitterBSClass(this);
return true;
});

$("p.tags a").each(function() {
addTwitterBSClass(this);
return true;
});

$("ol.commentlist a.comment-reply-link").each(function() {
$(this).addClass('btn success small');
return true;
});

}); /* end of as page load scripts */
8 changes: 1 addition & 7 deletions search.php
Expand Up @@ -64,13 +64,7 @@

</div> <!-- end #main -->

<div id="sidebar1" class="sidebar span6">

<?php get_search_form(); ?>



</div>
<?php get_sidebar(); // sidebar 1 ?>

</div> <!-- end #content -->

Expand Down
9 changes: 3 additions & 6 deletions searchform.php
@@ -1,13 +1,10 @@
<form action="<?php echo home_url( '/' ); ?>" method="get">
<form action="<?php echo home_url( '/' ); ?>" method="get" class="form-stacked">
<fieldset>
<div class="clearfix">
<label for="s">Search</label>
<div class="input">
<input type="text" name="s" id="search" value="<?php the_search_query(); ?>" />
</div>
<div class="actions">
<input type="text" name="s" id="search" placeholder="Search" value="<?php the_search_query(); ?>" />
<button type="submit" class="btn primary">Search</button>
</div>
</div>
</div>
</fieldset>
</form>
2 changes: 1 addition & 1 deletion single.php
Expand Up @@ -24,7 +24,7 @@

<footer>

<?php the_tags('<p class="tags"><span class="tags-title">Tags:</span> ', ', ', '</p>'); ?>
<?php the_tags('<p class="tags"><span class="tags-title">Tags:</span> ', ' ', '</p>'); ?>

</footer> <!-- end article footer -->

Expand Down
31 changes: 28 additions & 3 deletions style.css
Expand Up @@ -37,7 +37,8 @@
margin-bottom: 18px;
}

ol.commentlist{
ol.commentlist,
ul.children{
list-style-type: none;
margin-left: 0;
}
Expand All @@ -46,7 +47,12 @@ ol.commentlist div.avatar{
float: left;
}

ol.commentlist header{
ol.commentlist time{
font-size: .8em;
color: #eeeeee;
}

ol.commentlist div.comment-author{
position: relative;
}

Expand All @@ -61,6 +67,16 @@ ol.commentlist span.edit-comment{
top: 0;
}

a.comment-reply-link{
position: absolute;
right: 0;
bottom: 0;
}

#cancel-comment-reply{
padding-left: 20px;
}

#comment-nav ul{
list-style-type: none;
margin: 0;
Expand All @@ -73,10 +89,19 @@ ol.commentlist span.edit-comment{

/* widget styles */

#tag-cloud{
margin-bottom: 18px;
}

/* override standard link hover for the tag cloud widget */
#tag-cloud a:hover{
#tag-cloud a:hover,
.tags a:hover{
color: #ffffff;
text-decoration: none;
}

/* change default form padding for search */

.widget_search form{
padding-left: 0;
}

0 comments on commit 9173626

Please sign in to comment.