--------------------------------------------------------------------------------
/stylesheets/library/_nocss3.sass:
--------------------------------------------------------------------------------
1 | // This helps you toggle CSS3 mixins to make sure your site design doesn't depend on them.
2 | // Simply import this file to turn off all css3 called with Compass mixins.
3 | // Comment out the import to turn them on again.
4 |
5 | =linear-gradient($no: 0, $no: 0, $no: 0, $no: 0)
6 | =box-shadow($no: 0, $no: 0, $no: 0, !no: 0)
7 | =text-shadow($no: 0, $no: 0, $no: 0, $no: 0)
8 | =border-radius($no: 0)
9 | =border-top-left-radius($no: 0)
10 | =border-top-right-radius($no: 0)
11 | =border-bottom-left-radius($no: 0)
12 | =border-bottom-right-radius($no: 0)
--------------------------------------------------------------------------------
/Changelog.markdown:
--------------------------------------------------------------------------------
1 | ## 1.02
2 | - Added support for bundler and RVM. If you're not already using compass, setup is easier.
3 | - Fixed typography issue for ordered lists.
4 | - Added included the just released Modernizer 1.6 javascript library.
5 |
6 | ## 1.01
7 |
8 | I added an event listener to the html5 video player so that clicking anywhere on the video will begin preloading and enable autoplay.
9 | I did this because it resembles the typical behavior of common flash video players. I don't like having to click the play button twice.
10 | Once to load. A second time to play.
11 |
12 | ## 1.0 - Initial release
--------------------------------------------------------------------------------
/config.rb:
--------------------------------------------------------------------------------
1 | # Require any additional compass plugins here.
2 |
3 | # Require any additional compass plugins here.
4 | # Set this to the root of your project when deployed:
5 |
6 | http_path = "/wp-content/themes/wp-life/"
7 | css_dir = "/"
8 | sass_dir = "/stylesheets"
9 | fonts_dir = "fonts"
10 | images_dir = "images"
11 | javascripts_dir = "javascripts"
12 | output_style = :compact # CSS is nice and compact
13 | line_comments = false # Tight
14 |
15 | # To enable relative paths to assets via compass helper functions. Uncomment:
16 | # relative_assets = true
--------------------------------------------------------------------------------
/stylesheets/library/_defaults.sass:
--------------------------------------------------------------------------------
1 | @import compass
2 | +global-reset
3 | +reset-html5
4 | //@import library/nocss3
5 |
6 |
7 | //base classes
8 | .round-corners
9 | +border-radius(6px)
10 | .round-right-corners
11 | @extend .round-corners
12 | @extend .clear-left-rounding
13 | .round-left-corners
14 | @extend .round-corners
15 | @extend .clear-right-rounding
16 | .round-top-corners
17 | @extend .round-corners
18 | @extend .clear-bottom-rounding
19 | .round-bottom-corners
20 | @extend .round-corners
21 | @extend .clear-top-rounding
22 |
23 | .clear
24 | +pie-clearfix
25 |
26 | .hover-underline
27 | @extend .clear-underline
28 | &:hover
29 | text-decoration: underline
--------------------------------------------------------------------------------
/partials/_archives_header.php:
--------------------------------------------------------------------------------
1 |
2 | /* If this is a category archive */ if (is_category()) { ?>
3 | Archive for the ‘’ category
4 | /* If this is a tag archive */ } elseif( is_tag() ) { ?>
5 | Posts Tagged ‘’
6 | /* If this is a daily archive */ } elseif (is_day()) { ?>
7 | Archive for
8 | /* If this is a monthly archive */ } elseif (is_month()) { ?>
9 | Archive for
10 | /* If this is a yearly archive */ } elseif (is_year()) { ?>
11 | Archive for
12 | /* If this is an author archive */ } ?>
13 |
--------------------------------------------------------------------------------
/layouts/_head.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | » Blog Archive
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/stylesheets/partials/_typography.sass:
--------------------------------------------------------------------------------
1 | .sans-font
2 | font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif
3 | .serif-font
4 | font-family: Georgia, Times, "Times New Roman", serif
5 | .fixed-font
6 | font-family: "Menlo", "Bitstream Vera Sans", Monaco, "Andale Mono", "Lucida Console", monospace
7 |
8 | /* If you'd prefer to use ChunkFive (also free) switch them out below, or use whatever you want */
9 |
10 | +font-face("Megalopolis", font-files("megalopolisextra", woff, "megalopolisextra.ttf", truetype, "megalopolisextra.svg#webfontTi2cg57S", svg), 'megalopolisextra.eot')
11 | //+font-face("ChunkFive", font-files("Chunkfive-webfont", woff, "Chunkfive-webfont.ttf", truetype, "Chunkfive-webfont.svg#webfontb5K2fJwj", svg), 'Chunkfive-webfont.eot')
12 |
13 | .heading-font
14 | font-family: 'Megalopolis', arial, serif
15 | font-style: normal
16 | font-weight: normal
17 | .h1-font
18 | @extend .heading-font
19 |
20 |
21 | strong
22 | font-weight: bold
23 | em
24 | font-style: italic
25 | body
26 | font-size: 16px
27 | @extend .sans-font
28 | line-height: 1.45em
29 | p
30 | padding-bottom: 1em
31 |
32 | #{headings(2,6)}
33 | @extend .heading-font
34 | margin-bottom: .1em
35 | line-height: 1.2em
36 |
37 | h6
38 | font-size: 1.1em
39 | h5
40 | font-size: 1.3em
41 | h4
42 | font-size: 1.5em
43 | h3
44 | font-size: 2em
45 | h2
46 | font-size: 3em
47 | h1
48 | font-size: 4.8em
49 | margin-bottom: 0
50 | p, ul, ol
51 | padding-bottom: 1.1em
52 |
53 | #sidebar
54 | h3
55 | font-size: 1.6em
56 | h4
57 | font-size: 1.3em
58 |
59 | #main
60 | ul
61 | list-style: inside disc
62 | ol
63 | list-style: inside decimal
--------------------------------------------------------------------------------
/javascripts/site.js:
--------------------------------------------------------------------------------
1 | window.addEvent('domready', function() {
2 | html5toFlash();
3 | captionizer();
4 | });
5 |
6 | function html5toFlash(){
7 | var videos = $$('video');
8 | if(!videos){return}
9 | videos.each(function(video){
10 | source = video.getElement('source').get('src');
11 | if(!source.contains('mp4') || !Modernizr.video.h264){
12 | span = new Element('span', {'class':'video'}).wraps(video);
13 | flashvid = new Swiff(flashplayerlocation, {
14 | width : video.get('width').toInt(),
15 | height : video.get('height').toInt() + 29,
16 | params : {
17 | movie : source,
18 | wmode : "opaque",
19 | allowfullscreen : "true"
20 | },
21 | vars : {
22 | file : source,
23 | image : video.get('poster'),
24 | skin : flashplayerskin
25 | },
26 | container: span
27 | });
28 | video.dispose();
29 | } else if(video.get('preload') == "none"){
30 | video.addEvent('click', function(event){
31 | clickToLoad(video);
32 | });
33 | }
34 | })
35 | }
36 |
37 | function clickToLoad(video){
38 | video.set('preload', true);
39 | if(!video.get('autoplay')){
40 | video.set('autoplay', true);
41 | }
42 | video.removeEvent('click', clickToLoad);
43 | }
44 |
45 | function captionizer(){
46 | //add captions from titles
47 | $$('img[title]').filter(function(img){ return !img.getParent('.gallery-item')}).each(function(image){
48 | captionImage(image, image.get('title'));
49 | });
50 | //add captions from quotes
51 | $$('q').each(function(caption){
52 | text = caption.get('html');
53 | target = caption.getPrevious('img')
54 | if(!target){
55 | p = caption.getParent();
56 | target = p.getPrevious().getLast('img')
57 | console.log(p)
58 | p.destroy();
59 | }
60 | caption.destroy();
61 | captionImage(target, text);
62 | });
63 |
64 | }
65 | function captionImage(image, caption){
66 | title = caption
67 | wrap = new Element('span', {'class':'img-wrap', 'styles':{'width':image.get('width').toInt()+'px'}}).wraps(image);
68 | new Element('span', {'class':'caption', 'html':title, 'styles':{'width':(image.get('width').toInt() - 10 )+'px'}}).inject(image, 'after');
69 | }
--------------------------------------------------------------------------------
/Readme.markdown:
--------------------------------------------------------------------------------
1 | # What is wp-life?
2 |
3 | I wrote a very minimal WordPress theme for my family blog. This is it. When I say minimal, I mean it.
4 | Here's a list of what **this doesn't have**:
5 |
6 | - A sidebar
7 | - Navigation
8 | - Search
9 | - Widgets
10 | - And More!
11 |
12 | ### Who is this for?
13 |
14 | Me. But you can use it too if you like. If you're like me and you want to make your family blog look nice, but you're sick of flipping through crappy free WordPress themes or suffering through editing a crappy free WordPress theme, just to share pictures of your son with your mother-in-law. Perhaps you'll like this instead.
15 |
16 | ### WordPress Themes suck (a short rant)
17 |
18 | I strongly dislike (to put it mildly) how nearly all WordPress themes are written. There is almost no concept of reuse built in, and WordPress uses annoying functions like get_header(); to basically import header.php. Changing your HTML layout usually means
19 | making the same edits across many different files. It just plain sucks. You already know this because you learned to write WordPress themes by modifying existing themes.
20 |
21 | With WordPress themes frequently HTML tags (like `
`) opened in one file and closed in another file, which is liked through a magical WordPress function. This makes editing a real pain since you can use text editor folding, and you have to keep track
22 | of closed divs across multiple files. This leads to lots of inline HTML comments like `` scattered across the theme.
23 | Updating custom WordPress themes is a pain which typically involves messing about with replacing files over ftp.
24 |
25 | ### How WP-Life fixes that
26 |
27 | 1. **Layouts & Partials** - WordPress conditions call a simple render function using server site imports to create sensible layouts and partials. This maximizes reuse and allows for sensible HTML.
28 | 2. **Rsync Deployment** - Update the Rakefile with your hosting account's ssh username and theme path eg. "user@host.com" "~/document_root/wp-content/themes/wp-life". Then run `rake push` from the terminal to update your theme instantly.
29 | 3. **Compass/Sass** - Simple organized stylesheets with Compass and Sass. All my projects use this. Yours should too.
30 | 4. **Modernizer & HTML5 video support** - I'm using the HTML5 video element with h.264 and I'm not re-encoding my video for FireFox. Instead I'm using [Modernizer.js](http://modernizr.com) (included) to detect h.264 support and MooTools to swap out for a flash player using the same h.264 video.
31 | 5. **Captioned images** - If images have a title attribute set, that's all you need. I've written some javascript (in site.js) that adds nicely styled captions. Also if you prefer, you can add captions as a `` element after any image. The script will detect it and add it to the preceding image.
32 | 6. **Font-face** - For that custom-web flavor, I'm using CSS3's @font-face support (with free fonts from [FontSquirrel](http://fontsquirrel.com/)). Checkout /stylesheets/partials/_typography.sass to change this.
33 |
34 | ### Got a problem?
35 |
36 | If you have problems with it, I'll read issues posted on github or comments here — but I'm not going to hold your hand or anything.
--------------------------------------------------------------------------------
/comments.php:
--------------------------------------------------------------------------------
1 |
2 | if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])){
3 | die ('Please do not load this page directly. Thanks!');
4 | }
5 | // if there's a password
6 | if (!empty($post->post_password)) {
7 | // and it doesn't match the cookie
8 | if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { ?>
9 |
This post is password protected. Enter the password to view comments.
comments_number('No Comments', 'One Comment', '% Comments' );?>
21 |22 | foreach ($comments as $comment) { 23 | render('/partials/_comment'); 24 | } ?> 25 | else : // There are no comments so far ?> 26 | if ('open' == $post->comment_status) : ?> 27 | 28 | else : // comments are closed ?> 29 | 30 | endif; ?> 31 | endif; ?> 32 | 33 | 34 | 35 | if ('open' == $post->comment_status) { ?> 36 |
69 | endif; ?> 70 | } ?> 71 |Leave a Comment
37 | if ( get_option('comment_registration') && !$user_ID ) : ?> 38 |You must be logged in to post a comment.
39 | else : ?> 40 | if ( $user_ID ) { ?> 41 |Logged in as . Log out »
42 | } ?> 43 | 44 |