Skip to content

Commit

Permalink
Modernization of Wordpress templates & cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
somerandomdude committed Apr 2, 2012
1 parent e4243ce commit fd859c5
Show file tree
Hide file tree
Showing 17 changed files with 352 additions and 266 deletions.
Binary file not shown.

Large diffs are not rendered by default.

71 changes: 24 additions & 47 deletions frank/comments.php
Expand Up @@ -26,26 +26,11 @@
<div id='comments_content'>
<?php if ($comments) : ?>
<ul id="comments">
<?php foreach ($comments as $comment) : ?>
<li class="comment row">
<div class="content nine columns push-three">
<?php if ($comment->comment_approved == '0') : echo "<span id='comment_moderation'>Your comment is awaiting moderation.</span>"; endif; ?>
<?php comment_text() ?>
</div>
<div class="comment-info three columns pull-nine">
<ul class='metadata vertical'>
<li class="date"><time datetime="<?php the_time('Y-m-d'); ?>"><?php comment_date('F d, Y g:i A'); ?></time></li>
<li class='author' id="vcard-<?php comment_ID() ?>">By <a class="url fn" href="<?php comment_author_url(); ?>"><?php comment_author(); ?></a></li>
<li><?php edit_comment_link('edit'); ?></li>
</ul>


</div>
</li>
<?php $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : ''; ?>

<?php endforeach; ?>

<?php wp_list_comments( array( 'callback' => 'frank_comment' ) ); ?>

</ul>
<?php paginate_comments_links(); ?>
<?php else : // this is displayed if there are no comments so far ?>

<?php if ('open' == $post->comment_status) : ?>
Expand All @@ -63,34 +48,26 @@
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>

<?php else : ?>
<header>
<h1>Leave Your Own Comment</h1>
</header>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( !$user_ID ) : ?>
<div class='three columns' id="comment_form_info">
<label for="author">Name <?php if ($req) echo "(required)"; ?></label>
<input autocomplete="off" type="text" name="author" placeholder="Name (required)" id="author" value="<?php echo $comment_author; ?>" size="22" class="textinput" tabindex="1" />
<label for="email">Email <?php if ($req) echo "(required)"; ?></label>
<input autocomplete="off" type="text" name="email" placeholder="Email (required)" id="email" value="<?php echo $comment_author_email; ?>" size="22" class="textinput" tabindex="2" />
<label for="url">Website</label>
<input autocomplete="off" type="text" name="url" placeholder="URL" id="url" value="<?php echo $comment_author_url; ?>" size="22" class="textinput" tabindex="3" />
</div>
<?php else : ?>
<div id='comment_form_info' class='three columns'>
By <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a> (<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out&hellip;</a>)
</div>
<?php endif; ?>

<div id="comment_form_comment" class='nine columns <?php if ( $user_ID ) : ?>loggedin<?php endif; ?>'>
<label for="comment">Your Comment</label>
<textarea name="comment" placeholder="Your Comment" class="<?php if ( $user_ID ) echo('loggedin') ?>" id="comment" rows="10" tabindex="4"></textarea>
<input name="submit" type="submit" id="submit" class="button <?php if ( $user_ID ) echo('loggedin') ?>" tabindex="5" value="Submit Comment" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</div>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php else : ?>
<?php
$fields = array(
'author' => '<div class="three columns" id="comment_form_info">' . '<label for="author">' . __( 'Name' ) . '' . ( $req ? '<span class="required">*</span>' : '' ) . '</label> ' .
'<input id="author" name="author" type="text" placeholder="Name (required)" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />',
'email' => '<label for="email">' . __( 'Email' ) . '' . ( $req ? '<span class="required">*</span>' : '' ) . '</label> ' .
'<input id="email" name="email" type="text" placeholder="Email (required)" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />',
'url' => '<label for="url">' . __( 'Website' ) . '</label>' .
'<input id="url" name="url" type="text" placeholder="Website" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></div>',
);

$comment_field = '<div id="comment_form_comment" class="nine columns"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><textarea id="comment" placeholder="Your Comment" name="comment" aria-required="true"></textarea></div>';

$logged_in_as = '<div class="logged-in-as three columns"><p>' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p></div>';

$comment_notes_after = '<div class="row"><div class="form-allowed-tags nine columns push-three"><p class="">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p></div></div>';

comment_form(array('id_form' => 'frm-comment', 'logged_in_as' => $logged_in_as, 'comment_notes_before' => '', 'comment_notes_after' => $comment_notes_after, 'title_reply' => '<header><h1>Leave a Comment</h1></header>', 'fields' => $fields, 'comment_field' => $comment_field));
?>

</div>
<?php endif; endif; ?>
</div>
Expand Down
32 changes: 32 additions & 0 deletions frank/functions.php
@@ -1,5 +1,12 @@
<?php

if ( ! isset( $content_width ) ) $content_width = 980;

define('HEADER_TEXTCOLOR', 'ffffff');
define('HEADER_IMAGE', '%s/images/default_header.jpg'); // %s is the template dir uri
define('HEADER_IMAGE_WIDTH', 980); // use width and height appropriate for your theme
define('HEADER_IMAGE_HEIGHT', 200);

// Remove rel attribute from the category list - thanks Joseph (http://josephleedy.me/blog/make-wordpress-category-list-valid-by-removing-rel-attribute/)!
function remove_category_list_rel($output)
{
Expand All @@ -22,6 +29,8 @@ function my_init_method() {


if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'automatic-feed-links' );

add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) );
add_post_type_support( 'page', 'post-formats' );

Expand Down Expand Up @@ -216,6 +225,29 @@ function frank_devmode() {
if($frank_general) return $frank_general['devmode'];
}

function frank_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>

<li <?php comment_class('row'); ?> id="li-comment-<?php comment_ID() ?>">
<div class="content nine columns push-three">
<?php if ($comment->comment_approved == '0') : echo "<span id='comment_moderation'>Your comment is awaiting moderation.</span>"; endif; ?>
<?php comment_text() ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
<div class="comment-info three columns pull-nine">
<ul class='metadata vertical'>
<li class="date"><time datetime="<?php the_time('Y-m-d'); ?>"><?php comment_date('F d, Y g:i A'); ?></time></li>
<li class='author' id="vcard-<?php comment_ID() ?>">By <a class="url fn" href="<?php comment_author_url(); ?>"><?php comment_author(); ?></a></li>
<li><?php edit_comment_link('edit'); ?></li>
</ul>


</div>
<?php
}

add_action('wp_footer', 'frank_footer');
add_action('wp_head', 'frank_header');
?>
60 changes: 30 additions & 30 deletions frank/header.php
Expand Up @@ -7,63 +7,63 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta charset="UTF-8" />
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
<meta name="viewport" content="width=device-width" />

<title><?php if (function_exists('is_tag') && is_tag()) { echo 'Tag Archive for &quot;'.$tag.'&quot;&mdash;'; } elseif (is_archive()) { wp_title(''); echo ' Archive&mdash;'; } elseif (is_search()) { echo 'Search for &quot;'.wp_specialchars($s).'&quot;&mdash;'; } elseif (!(is_404()) && (is_single()) || (is_page())) { wp_title(''); echo '&mdash;'; } elseif (is_404()) { echo 'Not Found&mdash;'; } bloginfo('name'); ?></title>

<?php if(frank_devmode()) : ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/grid.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/global.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/forms.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/widgets.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/sprites.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/transitions.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/header.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/index.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/single.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/archive.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/fourohfour.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/sidebar.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/comments.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/footer.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/colorbox.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/hacks.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/mobile.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/print.css" type="text/css" media="all" />
<?php else : ?>
<?php if(!frank_devmode()) : ?>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<?php else : ?>
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/grid.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/global.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/forms.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/widgets.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/sprites.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/transitions.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/header.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/index.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/single.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/archive.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/fourohfour.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/sidebar.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/comments.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/footer.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/colorbox.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/hacks.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/mobile.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?php get_template_directory_uri(); ?>/stylesheets/css/print.css" type="text/css" media="all" />
<?php endif; ?>

<!--[if IE]>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/ie.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php get_template_directory_uri();; ?>/stylesheets/css/ie.css" type="text/css" media="screen" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/stylesheets/css/ie7.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php get_template_directory_uri();; ?>/stylesheets/css/ie7.css" type="text/css" media="screen" />
<![endif]-->

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php get_feed_link( 'rss2' ) ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php wp_head(); ?>

<!--[if lte IE 8]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE7.js"></script>
<![endif]-->
<![endif]-->
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
</head>
<body id="page">
<body id="page" <?php body_class($class); ?>>
<div class="container">
<div class="row">
<header id="page_header">
<div class='row'>
<hgroup class='9 columns'>
<h1 id="title"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
<h1 id="title"><a href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a></h1>
<h2 id="description"><?php bloginfo('description'); ?></h2>
</hgroup>
</div>
Expand Down
14 changes: 7 additions & 7 deletions frank/index.php
Expand Up @@ -18,30 +18,30 @@

switch($display_type) {
case 'srd_loop':
include 'templates/srd_loop.php';
locate_template( array('templates/srd_loop.php'), $load = true, $require_once = true );
break;
case 'one_up_reg':
$queryObject = new WP_Query(array('posts_per_page' => $num_posts, 'cat' => implode(",",array_filter($categories))));
include 'templates/one_up_reg.php';
locate_template( array('templates/one_up_reg.php'), $load = true, $require_once = true );
break;
case 'one_up_lg':
$queryObject = new WP_Query(array('posts_per_page' => $num_posts, 'cat' => implode(",",array_filter($categories))));
include 'templates/one_up_lg.php';
locate_template( array('templates/one_up_lg.php'), $load = true, $require_once = true );
break;
case 'two_up':
$queryObject = new WP_Query(array('posts_per_page' => $num_posts, 'cat' => implode(",",array_filter($categories))));
include 'templates/two_up.php';
locate_template( array('templates/two_up.php'), $load = true, $require_once = true );
break;
case 'three_up':
$queryObject = new WP_Query(array('posts_per_page' => $num_posts, 'cat' => implode(",",array_filter($categories))));
include 'templates/three_up.php';
locate_template( array('templates/three_up.php'), $load = true, $require_once = true );
break;
case 'four_up':
$queryObject = new WP_Query(array('posts_per_page' => $num_posts, 'cat' => implode(",",array_filter($categories))));
include 'templates/four_up.php';
locate_template( array('templates/four_up.php'), $load = true, $require_once = true );
break;
default :
include 'templates/default_loop.php';
locate_template( array('templates/default_loop.php'), $load = true, $require_once = true );
}

}
Expand Down
6 changes: 4 additions & 2 deletions frank/style.css

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions frank/stylesheets/css/comments.css
Expand Up @@ -11,6 +11,8 @@
#comments_container #comments li.comment {
margin: 60px 0;
background: none; }
#comments_container #comments li.comment.bypostauthor {
margin: 45px 0; }
#comments_container #comments li:first-child {
margin-top: 0px; }
#comments_container #comments .content {
Expand All @@ -28,28 +30,29 @@
font-size: 28px;
margin: 30px 0;
color: #5d504f; }
#comments_container #commentform input[type=text], #comments_container #commentform textarea {
#comments_container #respond input[type=text], #comments_container #respond textarea {
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 100%; }
#comments_container #commentform label {
#comments_container #respond label {
display: none; }
#comments_container #commentform #comment_form_info input[type=text] {
#comments_container #respond #comment_form_info input[type=text] {
margin-bottom: 15px;
text-align: right; }
#comments_container #commentform textarea {
#comments_container #respond textarea {
margin: 0;
height: 118px; }
#comments_container #commentform textarea:focus {
#comments_container #respond textarea:focus {
height: 375px; }
#comments_container #comment_form header h1 {
font-size: 20px; }
#comments_container #comment_form header .loggedin {
font-style: italic; }
#comments_container #submit {
margin-top: 15px; }
margin-top: 15px;
margin-left: 26.1%; }

/*MOBILE*/
@media only screen and (max-width: 767px) {
Expand Down
17 changes: 12 additions & 5 deletions frank/stylesheets/css/global.css
Expand Up @@ -228,6 +228,13 @@ header {
.crop {
overflow: hidden; }

.truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis; }

/*Wordpress Classes*/
.alignleft, .alignright, .aligncenter {
margin: 10px 0 15px 0; }

Expand Down Expand Up @@ -257,11 +264,11 @@ header {
color: #5d504f;
margin-top: 10px; }

.truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis; }
.bypostauthor {
border: 2px solid #5d504f;
padding: 15px 0;
border-left: 0;
border-right: 0; }

/*Pagination links*/
.pagination {
Expand Down
7 changes: 5 additions & 2 deletions frank/stylesheets/scss/comments.scss
Expand Up @@ -16,6 +16,9 @@
margin:$row-height*4 0;
background: none;
}
li.comment.bypostauthor {
margin:$row-height*3 0;
}
li:first-child { margin-top: 0px; }

.content {
Expand All @@ -37,7 +40,7 @@
margin: $row-height * 2 0;
color: $color_midtone;
}
#commentform {
#respond {

input[type=text], textarea {
-moz-box-sizing: border-box;
Expand Down Expand Up @@ -66,7 +69,7 @@
}
}
}
#submit { margin-top: $row-height; }
#submit { margin-top: $row-height; margin-left: 26.1%; }
}

/*MOBILE*/
Expand Down

0 comments on commit fd859c5

Please sign in to comment.