html5 Comments in Wordpress – quickfix

Introduction

I’m not even going to acknowledge my terrible blogging habits ( or in reality, lack thereof ) and get to a little something something that will hopefully be of some use to someone.

With html5 making a lot of noise and gaining steam ( Google Voice & Youtube as examples ), it’s only a matter of time.

On January 25th, 2010, a nice chap by the name of Nathan Staines released his html5 version of Elliot Jay StocksStarkers theme.

As I’m still in the process of learning the nuances of html5 I decided to use Starkers html5 as a learning ground. Being a typical twitter user I let the world know what I was up to. Nathan fairly quickly responded, asking my thoughts and recommendations on any adjustments, I replied in kind.

I sat down to see if I could tackle it, I’ve always been a bit wary of messing with the comments code for wordpress seeing as recursive code can get complicated if you don’t know exactly what is going on. I thought it was an excellent opportunity to learn and I came up with a (mostly) strait forward quick fix for now. I still want to go back and rewrite the wp_list_comments(); function but that will have to wait as I have other priorities.

My quick fix:
In the comments.php template file find this bit of code:
<?php wp_list_comments(...); ?> 

We’ll be using this instead:

<?php wp_list_comments('style=div&callback=html5_comment&end-callback=html5_closecomment'); ?>
'
In your theme’s functions.php file we’ll be adding the following code:
// Changes the trailing </li> into a trailing </article>
function html5_closecomment() {?>
	</article>
<?php
	}

// This is the new comment markup - edit as you feel necessary
function html5_comment($comment, $args, $depth) {
   $GLOBALS['comment'] = $comment; ?>

	<article id="comment-<?php comment_ID() ?>" <?php comment_class(); ?>>
		<header class="comment-author vcard">
			<?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>

			<?php printf(__('<cite class="fn">%s</cite> says:'), get_comment_author_link()) ?>

			<p><time pubdate><?php edit_comment_link(__('(Edit)'),'  ','') ?></time></p>

			<p><?php echo $args ['style']; ?></p>

		</header>
		<?php if ($comment->comment_approved == '0') : ?>
			<p><?php _e('Your comment is awaiting moderation.') ?></p>
		<?php endif; ?>

		<?php comment_text() ?>

		<footer class="reply"><?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></footer>

<?php
	}

This will force your comments to display like the following:


<article>

    <article> 
    
    </article>
</article>
...
...
A couple of notes

Usually, theme’s wrap the wp_list_comments(); call in an ordered list, this isn’t necessary for our super awesome html5 anymore since articles can (and I guess should) be nested. Personally I wrapped it in a div with “the_comments” as a class ( For styling purposes mainly. ).

These are the only changes I made to the starkers html5, take a look for yourself.

Feel free to use, modify and share as you like. Try to give references where they are due though, that’s all I ask.

Once I rewrite the function for wp_list_comments to handle ’style=article’ I’ll let you all know.

More on html5

W3C html5 spec overview

WhatWG.org html5 Working Draft

html5Doctor

html5 Gallery

Posted in Blog | Tagged , , , , , | Leave a comment

Week 1 (or so) Polyphasic Sleep Update

In my last post I covered an outline of my new sleep schedule. In this post, I’ll be summarizing all of the things that I learned in one week.

*Disclaimer* I’m not an expert after one week, but I figure if you were at all interested in my last post this is pertinent information as well.*

First off, thanks for all of the interest people are showing (I’m getting a lot of questions from friends & maybe a few odd looks too).

This past week has been up and down. I feel transitioning to the 3 hour + 3 nap schedule wasn’t really the difficult part. Sure, the mid-day nap for the first couple of days didn’t come easy. Initially I’d have a hard time falling asleep, but with the combination of my ‘black out bed’ and quickly getting tired enough around nap time it became less of an issue.

I’d have to say that for me, the real tricky part was adapting socially. This was an actual problem on Friday and Saturday. I’d be hanging out, or out at an event and I wouldn’t have an opportunity to just duck away for 20 minutes to get a nap in.

Failures

On Friday, after a week of near flawless sleep punctuality (sleepunctuality?!) I miscalculated (or rather, just didn’t plan…) and missed the afternoon and evening nap. Needless to say it killed me, I went to bed at 3:30 and woke at 8. And when I say ‘woke’ I use that term very loosely – think closer to the idea in which zombies are ‘awake’.

Apparently, I’m slow learner because I had a similar experience on Saturday too. I missed the afternoon nap, and was forced to take a break from hanging out with friends at 11:10ish and sleep on the floor upstairs for the evening nap. Needless to say, not the most effective sleep…

Successes

But it wasn’t all bad, in fact, a week that I wasn’t looking forward to at all because of how busy I was going to be work-wise became a breeze. Of course, my circumstances are special and I get the opportunity to set my own hours and tackle projects as I see fit. You 9 to 5′ers might not have this availability… But I bet with enough effort you could make it work as well.

I mentioned having an issue with the day naps and falling asleep earlier. Thanks to good ‘ole problem solving I was able to find a working solution to my issue.

My ‘black-out bed’

I just so happen to have an extra twin mattress that I have laying around for when I have an out of town visitor and what not. I also, just so happen to have a very large walk-in closet at my apartment. So, I followed the logical thought process and made a cave for day naps. I put a fan in there, it’s quaint.

Looking forward

I’m going to continue on, and give a little more care to Friday and Saturday plannings. And use general problem solving to deal with issues as they come. So far, I love it. It’s been up and down, and fairly difficult, but totally worth it I feel.

Have a much more specific question? Post it as a comment and I’ll try and get to it quickly, thanks!

Posted in personal | Tagged , , | Leave a comment

The start of something new: Everyman Polyphasic Sleep Schedule

So, as you may (or may not) have noticed, I haven’t blogged in a long time. Not since Wordcamp Dallas/Ft. Worth in fact. Trust me, it isn’t because I don’t like you. I do, I really do. I’ve just been so busy as of late that all of my free time has been spent investing in relationships so that I stay sane.

I’ve been so busy that I’ve had to continue to push my personal Thematic child-theme portfolio & blog redesign back a few times (something I really want & need to do). It is coming along, but it is getting me frustrated. Don’t get me wrong! I love having enough work that I’m able to eat, but it seems that I’m always working, every free minute I’m designing & developing for clients instead of getting something done for myself that will be much more beneficial to my independent contractor (fancy for freelance) career in the long run. And even when I am with friends “rejuvenating”, I still am thinking/brainstorming for the project at hand.

The point is, I’m getting desperate I think, and for mental stability’s sake I’m afraid something dramatic might be needed.

Enter: The Everyman Polyphasic Sleep Schedule

In only a short description, the everyman sleep schedule is an alternative sleep schedule in which you have one 3 hour core sleep session and 3 twenty minute nap sessions.

If you are good at math, then you realize that is only 4 hours of sleep a day, and quickly following, you realize that sounds incredibly crazy.

I’ll be honest, it does. And, after much thought and one previous run in with polyphasic sleep back when I was in college I found out very intimately that it is.

My Everyman sleep schedule

My Everyman sleep schedule


But enough of that Nay-saying, I could write pages summarizing the main arguments on how it is a bad idea… Let’s talk about how it is a good idea. After the adjustment period, I’d have a fully functioning 20 hour day. Typically, if you want an effective 20 hour day you bleed coffee and red bull and then the whole rest of the week is usually a total wash because you are totally crashed.

With the various polyphasic sleep schedules you literally train your body to dive into the REM phase of sleep almost immediately which allows you to gain extra hours in the day. A possible extra added bonus is much more vivid dreams, people have reported to have amazingly vivid dreams as well as a clarity in recalling them. An extra creative boost, totally rad, right?

I’ll be honest, there isn’t a whole lot of ’scientific’ research into the mental & physical long term effects but one google search and find a plethora of first hand testimony. I’m telling you through my blog about it because if I tell the world and keep tabs on the process I feel like I’ve got a sort of responsibility to following through. If I just keep it in my head, I’m sure I’ll fold after a month or so.

Here is the plan. 3 hour core nap from 4:30 am – 7:30 am, followed by a 5 hour shift or work. 1 20 minute nap from 12:30 pm – 12:50 pm, followed by another 5 hour shift. Another 20 minute nap from 5:50 pm – 6:10 pm, followed by another 5 hour shift. The last 20 minute nap is from 11:10 pm – 11:30 pm followed by the final 5 hour shift.

Initially, I want to stay as disciplined with the regimen as possibly as I can. The everyman schedule has reported advantages of being much more flexible in that you have a deviation time of about an hour or so for your naps without totally killing yourself or the rotation (missing a nap in the Uberman sleep schedule is like missing a full nights sleep). That is the plan, and this is the first week I’m doing it. It is already going to well, look what I’ve done in 20 minutes of my 4-5.5 hours of extra time! If you could text/twitter/or facebook me, I would really appreciate the encouragement and support.

So, I leave you with two questions.

A.) What is your opinion of my (maybe a little dramatic, but needed) experiement?
B.) What would you do with your extra free time if you had 20 hour days all the time?

More interested in finding out more about polyphasic sleep? Go here. More interested in first hand experience of polyphasic sleep in action? Here is a blog. And lastly, a great write up on the Everyman Sleep Schedule, here.

Posted in news, personal | 1 Comment

WCDFW09 W4H1: Mark Taylor

This next guy has a great wordpress story and I hope the everyone gets a hold of him to hear it strait from him. I had the opportunity and I’m glad I took it.

Who: Meet Mark Taylor.
What: Mark is the owner of TAYLORMARK, a Digital Life Service. They offer services in recover, support, banking and consulting. What are they using WP for? It runs their website!
When: Mark got into wordpress THIS MONTH! Can you believe that?! And his company was a WCDFW09 sponsor too, that is some quick work and adoption!
Where: Mark is from the big D.
How: He is using WP so he doesn’t have to rely on a coder/designer to make small changes, updates and modifications. “It just allows our business to be nimble. I get to prototype the site will satisfaction then publish it.”

Be sure and follow her on Twitter or check out his website. You can also follow his company on twitter at: http://twitter.com/taylormark.

The wordpress community in Dallas is still around, even if Wordcamp is over. If you’d like to introduce yourself and get to know some of us, let me know or @ me. I’d love to give you a quick interview and help introduce you!

Be sure and check out the DFW wordpress meet up group. We meet once a month and it is always a great time. If you are on twitter, we use the hashtag #dfwwp so you can follow the conversations there too.

Posted in wcdfw09, wordpress | Tagged , , , , , | Leave a comment

WCDFW09 W4H1: Kat Rice

Hi again WCDFW09! Wasn’t the weekend wonderful? Let me introduce you to Kat.

Who: Meet Kat Rice.
What: Kat is the owner and a consultant for Veribatim web design and consultation. She is using wordpress in the following ways: running 90% of their clients on wp, they make custom plugins for wp too, and she also runs her personal blog on wp.
When: Kat got involved with wordpress about 2 years ago.
Where: Kat is from the Dallas area.
How: As far as how she is using wordpress, “it is the vehicle that her company reaches the goals and meets the needs of their clients. It is flexible and we would not be as effective without wordpress. I just believe in the platform.”

Be sure and follow her on Twitter or check out her website.

The wordpress community in Dallas is still around, even if Wordcamp is over. If you’d like to introduce yourself and get to know some of us, let me know or @ me. I’d love to give you a quick interview and help introduce you!

Be sure and check out the DFW wordpress meet up group. We meet once a month and it is always a great time. If you are on twitter, we use the hashtag #dfwwp so you can follow the conversations there too.

Posted in wcdfw09, wordpress | Tagged , , , | Leave a comment