Wordpress & HTML5 by Rob Larsen

Uploaded on

Rob Larsen presentation at WordCamp

Rob Larsen presentation at WordCamp

More in: Education , Technology , Design
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Note I didn’t use a <section> for the div id=content. It’s really just a generic container. If that was a section- the outline (which I’ll show you) would show “untitled section” because it’s not coupled with a header. The time element has a machine readable datetime attribute.
  • Note I didn’t use a <section> for the div id=content. It’s really just a generic container. If that was a section- the outline (which I’ll show you) would show “untitled section” because it’s not coupled with a header. The time element has a machine readable datetime attribute.


  • 1. HTML5 + WordPress Rob Larsen 1.23.2010 htmlcssjavascript.com | drunkenfist.com @robreact htmlcssjavascript.com /downloads/wordpress.ppt
  • 2. Who is this Guy Anyway?
    • 12+ years HTML/CSS/JavaScript. My job since 1999.
    • WordPress since 2005. Launched a ton of sites. Currently manage 6.
    • For the next 5 days: Principal Presentation Engineer at Cramer
    • Next Week: Molecular
    • PAST: AdvisorTech, Compete, Demandware, The Weekly Dig, Gillette, Museum of Science, Boston, PC Connection, State Street, Webex
  • 3. Introduction to HTML5
      • HTML5 is a lot of things-
      • Ongoing. This is a moving target. The spec can change underneath you. This can be fun, I swear. It also means there’s not always an answer. That, too, can be fun.
      • Occasionally controversial.
      • Full of cool stuff that’s got both browser and web developers excited
      • Something to pay attention to/ experiment with/ discuss and give feedback on (which is why we’re here today)
  • 4. What Are We Going To Talk About
      • Marking up a standard WordPress blog using some of the new, semantic elements/attributes. This is a subset of the spec that’s relatively stable and is usable right now. We’ll use a small bit of JavaScript or the Modernizr library to make styling these elements work in Internet Explorer.
      • Sweet.
  • 5. Meet the New Semantic Elements
    • <section> The section element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a heading. Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site's home page could be split into sections for an introduction, news items, contact information.
  • 6. Meet the New Semantic Elements
    • <nav> The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links. Not all groups of links on a page need to be in a nav element — only sections that consist of major navigation blocks are appropriate for the nav element. In particular, it is common for footers to have a short list of links to various pages of a site, such as the terms of service, the home page, and a copyright page. The footer element alone is sufficient for such cases, without a nav element
  • 7. Meet the New Semantic Elements
    • <article> The article element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a Web log entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
  • 8. Meet the New Semantic Elements
    • <aside> The aside element represents a section of a page that consists of content that is tangentially related to the content around the aside element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography. The element can be used for typographical effects like pull quotes or sidebars, for advertising, for groups of nav elements, and for other content that is considered separate from the main content of the page.
  • 9. Meet the New Semantic Elements
    • <hgroup> The hgroup element represents the heading of a section. The element is used to group a set of h1–h6 elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines.
    • “ Just another wordpress weblog”
  • 10. Meet the New Semantic Elements
    • <header> The header element represents a group of introductory or navigational aids. A header element is intended to usually contain the section’s heading (an h1–h6 element or an hgroup element), but this is not required. The header element can also be used to wrap a section’s table of contents, a search form, or any relevant logos.
  • 11. Meet the New Semantic Elements
    • <footer> The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like. Footers don’t necessarily have to appear at the end of a section, though they usually do. When the footer element contains entire sections, they represent appendices, indexes, long colophons, verbose license agreements, and other such content.
  • 12. Meet the New Semantic Elements
    • <time> The time element represents either a time on a 24 hour clock, or a precise date in the proleptic Gregorian calendar, optionally with a time and a time-zone offset.
  • 13. Meet the New Semantic Elements
    • <form> <input> attributes
    • Placeholder Text/Search Boxes
    • <input type=&quot;search&quot; placeholder=“Search Example.com&quot; name=&quot;s&quot; id=&quot;s&quot; />
    • Email Addresses
    • <input type=&quot;email&quot; class=&quot;text-input&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;&quot; size=&quot;22&quot; tabindex=&quot;2&quot; aria-required='true' />
    • Web Addresses
    • <input type=&quot;url&quot; class=&quot;text-input&quot; name=&quot;url&quot; id=&quot;url&quot; value=&quot;&quot; size=&quot;22“ tabindex=&quot;3&quot; />
  • 14. Isn’t All That New Stuff Just About Perfect for Marking up a Blog?
    • Heck yes.
  • 15. Let’s Look at Some Code
  • 16. header.php
    • <?php
    • /**
    • * @package WordPress
    • * @subpackage Kubrick_x_HTML5
    • */
    • ?>
    • <!DOCTYPE html>
    • <!--simplified!-->
    • <html <?php language_attributes(); ?>>
    • <!--simplified!-->
    • <head profile=&quot;http://gmpg.org/xfn/11&quot;>
    • <!--simplified!-->
    • <meta charset=&quot;<?php bloginfo('charset'); ?>&quot; />
    • <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
    • <script type=&quot;text/javascript&quot;>
    • var elem;
    • var elems = 'abbr article aside audio canvas datalist details eventsource figure footer header hgroup mark menu meter nav output progress section time video'.split(' ');
    • var i = elems.length+1;
    • while ( --i ) {
    • elem = document.createElement( elems[i] );
    • }
    • elem = null;
    • </script>
    • <link rel=&quot;stylesheet&quot; href=&quot;<?php bloginfo('stylesheet_url'); ?>&quot; media=&quot;screen&quot; />
    • <link rel=&quot;pingback&quot; href=&quot;<?php bloginfo('pingback_url'); ?>&quot; />
    Default/Kubrick (part 1)
  • 17. header.php
    • <style media=&quot;screen&quot;>
    • <?php
    • // Checks to see whether it needs a sidebar or not
    • if ( empty($withcomments) && !is_single() ) {
    • ?>
    • #page { background: url(&quot;<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg&quot;) repeat-y top; border: none; }
    • <?php } else { // No sidebar ?>
    • #page { background: url(&quot;<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg&quot;) repeat-y top; border: none; }
    • <?php } ?>
    • </style>
    • <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    • <?php wp_head(); ?>
    • </head>
    • <body <?php body_class(); ?>>
    • <div id=&quot;page&quot;>
    • <!--header-->
    • <header id=&quot;header&quot; >
    • <hgroup id=&quot;headerimg&quot;>
    • <h1><a href=&quot;<?php echo get_option('home'); ?>/&quot;><?php bloginfo('name'); ?></a></h1>
    • <h2 class=&quot;description&quot;><?php bloginfo('description'); ?></h2>
    • </hgroup>
    • </header>
    • <hr />
    Default/Kubrick (part 2)
  • 18. header.php
    • <!DOCTYPE html>
    • <html <?php language_attributes(); ?> class=“no-js”>
    • <head profile=&quot;http://gmpg.org/xfn/11&quot;>
    • <title>
    • <?php if ( is_front_page() ) {bloginfo('name');?> | Fresh Ideas Caught and Served <?php } else {;?>
    • <?php bloginfo('name');?> |
    • <?php if($post->post_parent) {
    • $parent_title = get_the_title($post->post_parent);
    • echo $parent_title;?>
    • &ndash;
    • <?php }?>
    • <?php wp_title(''); ?>
    • <?php } ?>
    • </title>
    • <meta charset=&quot;<?php bloginfo('charset'); ?>&quot; />
    • <meta name=&quot;description&quot; content=&quot;<?php echo get_post_meta($post->ID, &quot;meta-description&quot;, &quot;true&quot;); ?>&quot; />
    • <link rel=&quot;shortcut icon&quot; href=&quot;http://static.crameronline.com/_assets/images/favicon.ico&quot;/>
    • <script type=&quot;text/javascript&quot;>
    • var ___baseURL =&quot;<?php bloginfo('template_directory'); ?>&quot;;
    • </script>
    • <!—one file, which contains Modernizr 
    • <script type=&quot;text/javascript&quot; src=&quot;<?php bloginfo('template_directory'); ?>/_assets/scripts/b.c.js&quot;></script>
  • 19. View Source
    • <html lang=&quot;en-US&quot; dir=&quot;ltr&quot; class=&quot;js canvas canvastext geolocation rgba hsla no-multiplebgs borderimage borderradius boxshadow opacity no-cssanimations csscolumns no-cssgradients no-cssreflections csstransforms no-csstransforms3d no-csstransitions video audio fontface&quot;>
    • <!– such is the power of modernizr 
    • <head profile=&quot;http://gmpg.org/xfn/11&quot;>
    • <title>A Wider Net | Fresh Ideas Caught and Served </title>
    • <meta charset=&quot;UTF-8&quot;>
  • 20. index.php <?php /** * @package WordPress * @subpackage Kubrick_x_HTML5 */ get_header(); ?> <div id=&quot;content&quot; class=&quot;narrowcolumn&quot; > <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <article <?php post_class() ?> id=&quot;post-<?php the_ID(); ?>&quot;> <h1> <a href=&quot;<?php the_permalink() ?>&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to <?php the_title_attribute(); ?>&quot;><?php the_title(); ?></a> </h1> <time datetime=&quot;<?php the_time('c') ?>&quot; pubdate=&quot;pubdate&quot;><?php the_time('F jS, Y') ?></time> <div class=&quot;entry&quot;> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class=&quot;postmetadata&quot;><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </article> <?php endwhile; ?> <nav class=&quot;navigation&quot;> <div class=&quot;alignleft&quot;><?php next_posts_link('&laquo; Older Entries') ?></div> <div class=&quot;alignright&quot;><?php previous_posts_link('Newer Entries &raquo;') ?></div> </nav> <?php else : ?> <h1 class=&quot;center&quot;>Not Found</h1> <p class=&quot;center&quot;>Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> Default/Kubrick
  • 21. View Source s<article id=&quot;post-3&quot; class=&quot;post-3 post hentry category-uncategorized&quot;> <h1><a title=&quot;Permanent Link to This Is an HTML5ized Version of the Default Wordpress Theme&quot; rel=&quot;bookmark&quot; href=&quot;http://htmlcssjavascript.com/dev/?p=3&quot;>This Is an HTML5ized Version of the Default Wordpress Theme</a></h1> <time pubdate=&quot;pubdate&quot; datetime=&quot;2010-01-17T21:52:52+00:00&quot;>January 17th, 2010</time> <div class=&quot;entry&quot;> <p>Source Code and discussion.</p> </div> <p class=&quot;postmetadata&quot;> Posted in <a rel=&quot;category&quot; title=&quot;View all posts in Uncategorized&quot; href=&quot;http://htmlcssjavascript.com/dev/?cat=1&quot;>Uncategorized</a> | <a title=&quot;Edit post&quot; href=&quot;http://htmlcssjavascript.com/dev/wp-admin/post.php?action=edit&amp;post=3&quot; class=&quot;post-edit-link&quot;>Edit</a> | <a title=&quot;Comment on This Is an HTML5ized Version of the Default Wordpress Theme&quot; href=&quot;http://htmlcssjavascript.com/dev/?p=3#respond&quot;>No Comments »</a></p> </article> Default/Kubrick
  • 22. sidebar.php <?php /** * @package WordPress * @subpackage Kubrick_x_HTML5 */ ?> <aside id=&quot;sidebar&quot; > <ul> <?php /* Widgetized sidebar, if you have the plugin installed. */ if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> <!-- SNIP --> </li> <?php }?> </ul> <nav> <ul> <?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?> <li><h2>Archives</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </li> <?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?> </ul> </nav> <ul> <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <?php wp_list_bookmarks(); ?> <li><h2>Meta</h2> <!-- SNIP --> </li> <?php } ?> <?php endif; ?> </ul> </aside> Default/Kubrick
  • 23. searchform.php <?php /** * @package WordPress * @subpackage Kubrick_x_HTML5 */ ?> <form method=&quot;get&quot; id=&quot;searchform&quot; action=&quot;<?php bloginfo('url'); ?>&quot; > <div> <label class=&quot;screen-reader-text&quot; for=&quot;s&quot;>Search for:</label> <input type=&quot;search&quot; placeholder=&quot;Search <?php bloginfo('blogtitle'); ?>&quot; name=&quot;s&quot; id=&quot;s&quot; /> <input type=&quot;submit&quot; id=&quot;searchsubmit&quot; value=&quot;Search&quot; /> </div> </form> Default/Kubrick
  • 24. comments.php <?php // snip! ?> <?php if ( comments_open() ) : ?> <div id=&quot;comment-form&quot;> <h2><?php comment_form_title( 'Leave a comment', 'Leave a Reply to %s' ); ?></h2> <div class=&quot;cancel-comment-reply&quot;> <small><?php cancel_comment_reply_link(); ?></small> </div> <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?> <p>You must be <a href=&quot;<?php echo wp_login_url( get_permalink() ); ?>&quot;>logged in</a> to post a comment.</p> <?php else : ?> <form action=&quot;<?php echo get_option('siteurl'); ?>/wp-comments-post.php&quot; method=&quot;post&quot; id=&quot;commentform&quot;> <?php if ( is_user_logged_in() ) : ?> <p>Logged in as <a href=&quot;<?php echo get_option('siteurl'); ?>/wp-admin/profile.php&quot;><?php echo $user_identity; ?></a>. <a href=&quot;<?php echo wp_logout_url(get_permalink()); ?>&quot; title=&quot;Log out of this account&quot;>Log out &raquo;</a></p> <?php else : ?> <p><label for=&quot;author&quot;><small>Name <?php if ($req) echo &quot;(required)&quot;; ?></small></label><input type=&quot;text&quot; class=&quot;text-input&quot; name=&quot;author&quot; id=&quot;author&quot; value=&quot;<?php echo esc_attr($comment_author); ?>&quot; size=&quot;22&quot; tabindex=&quot;1&quot; <?php if ($req) echo &quot;aria-required='true'&quot;; ?> /> </p> <p><label for=&quot;email&quot;><small>Mail (will not be published) <?php if ($req) echo &quot;(required)&quot;; ?></small></label> <input type=&quot;email&quot; class=&quot;text-input&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;<?php echo esc_attr($comment_author_email); ?>&quot; size=&quot;22&quot; tabindex=&quot;2&quot; <?php if ($req) echo &quot;aria-required='true'&quot;; ?> /></p> <p><label for=&quot;url&quot;><small>Website</small></label>< input type=&quot;url&quot; class=&quot;text-input&quot; name=&quot;url&quot; id=&quot;url&quot; value=&quot;<?php echo esc_attr($comment_author_url); ?>&quot; size=&quot;22&quot; tabindex=&quot;3&quot; /> </p> <?php endif; ?> <p><label for=&quot;comment&quot;><small>Comments</small></label> <textarea name=&quot;comment&quot; cols=&quot;100%&quot; rows=&quot;10&quot; tabindex=&quot;4&quot;></textarea> </p> <div class=&quot;button&quot;><input name=&quot;submit&quot; type=&quot;submit&quot; id=&quot;submit&quot; tabindex=&quot;5&quot; value=&quot;Submit&quot; /></div> <?php comment_id_fields(); ?> <?php do_action('comment_form', $post->ID); ?> </form> <!—SNIP-  AWiderNet
  • 25. footer.php <?php /** * @package WordPress * @subpackage Kubrick_x_HTML5 */ ?> <hr /> <footer id=&quot;footer&quot; > <!-- If you'd like to support WordPress, having the &quot;powered by&quot; link somewhere on your blog is the best way; it's our only promotion or advertising. --> <p> <?php bloginfo('name'); ?> is proudly powered by <a href=&quot;http://wordpress.org/&quot;>WordPress</a> <br /><a href=&quot;<?php bloginfo('rss2_url'); ?>&quot;>Entries (RSS)</a> and <a href=&quot;<?php bloginfo('comments_rss2_url'); ?>&quot;>Comments (RSS)</a>. <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --> </p> </footer> </div> <!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ --> <?php /* &quot;Just what do you think you're doing Dave?&quot; */ ?> <?php wp_footer(); ?> </body> </html> Default/Kubrick
  • 26. What’s the Diff? footer.php
  • 27. archives.php <?php /** * @package WordPress * @subpackage Kubrick_x_HTML5 */ /* Template Name: Archives */ ?> <?php get_header(); ?> <div id=&quot;content&quot; class=&quot;widecolumn&quot;> <?php get_search_form(); ?> <section> <h2>Archives by Month:</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </section> <section> <h2>Archives by Subject:</h2> <ul> <?php wp_list_categories(); ?> </ul> </section> </div> <?php get_footer(); ?> Kubrick/default
  • 28. style.css /*SNIP!*/ /* Begin Structure */ body { margin: 0 0 20px 0; padding: 0; } /*HTML5*/ footer, section, article, aside, header, time { display:block; } #page { background-color: white; margin: 20px auto; padding: 0; width: 760px; border: 1px solid #959596; } #header /*SNIP!*/ Kubrick/default
  • 29. What’s the Diff? style.css
  • 30. style.css .borderradius.boxshadow.rgba #container #main article, .borderradius.boxshadow.rgba #container #main #posts > .meta-data, .borderradius.boxshadow.rgba #container #main #posts #no-results, .borderradius.boxshadow.rgba #container #main #posts .author { border-radius:10px; -moz-border-radius:10px; -webkit-border-radius:10px; -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, .15); box-shadow: 0px 0px 5px rgba(0, 0, 0, .15); -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, .15); background:#fff; overflow: hidden; } AWiderNet
  • 31. PSST! CSS3
  • 32. Things I Learned
    • The new outline algorithm is a fickle master
    • Otherwise- not so bad.
    • Kubrick worked with almost no browser specific intervention in modern browsers
  • 33. Any Questions?
  • 34. More Info
    • http://www.whatwg.org/
    • http://diveintohtml5.org/
    • http://www.modernizr.com/
    • http://gsnedders.html5.org/outliner/
    • http://htmlcssjavascript.com/html/im-messing-around-with-an-html5-version-of-the-default-wordpress-theme/