From edfeccc2557e899cf0b8297e9c5304725c862818 Mon Sep 17 00:00:00 2001 From: Ian Stewart Date: Sat, 7 Jan 2012 03:25:13 +0000 Subject: [PATCH] _s: initial fork of Toolbox --- 404.php | 47 +++++++ archive.php | 75 +++++++++++ author.php | 74 +++++++++++ category.php | 64 +++++++++ comments.php | 76 +++++++++++ content-aside.php | 36 ++++++ content-gallery.php | 86 +++++++++++++ content-image.php | 30 +++++ content-page.php | 20 +++ content-single.php | 59 +++++++++ content.php | 62 +++++++++ footer.php | 27 ++++ functions.php | 306 ++++++++++++++++++++++++++++++++++++++++++++ header.php | 75 +++++++++++ image.php | 110 ++++++++++++++++ index.php | 58 +++++++++ js/html5.js | 3 + license.txt | 281 ++++++++++++++++++++++++++++++++++++++++ page.php | 31 +++++ readme.txt | 1 + rtl.css | 17 +++ search.php | 50 ++++++++ sidebar.php | 40 ++++++ single.php | 34 +++++ style.css | 12 ++ tag.php | 66 ++++++++++ 26 files changed, 1740 insertions(+) create mode 100644 404.php create mode 100644 archive.php create mode 100644 author.php create mode 100644 category.php create mode 100644 comments.php create mode 100644 content-aside.php create mode 100644 content-gallery.php create mode 100644 content-image.php create mode 100644 content-page.php create mode 100644 content-single.php create mode 100644 content.php create mode 100644 footer.php create mode 100644 functions.php create mode 100644 header.php create mode 100644 image.php create mode 100644 index.php create mode 100644 js/html5.js create mode 100644 license.txt create mode 100644 page.php create mode 100644 readme.txt create mode 100644 rtl.css create mode 100644 search.php create mode 100644 sidebar.php create mode 100644 single.php create mode 100644 style.css create mode 100644 tag.php diff --git a/404.php b/404.php new file mode 100644 index 00000000..3fb99755 --- /dev/null +++ b/404.php @@ -0,0 +1,47 @@ + + +
+
+ +
+
+

+
+ +
+

+ + + + + +
+

+
    + 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10 ) ); ?> +
+
+ + ' . sprintf( __( 'Try looking in the monthly archives. %1$s', '_s' ), convert_smilies( ':)' ) ) . '

'; + the_widget( 'WP_Widget_Archives', 'dropdown=1', "after_title=$archive_content" ); + ?> + + + +
+
+ +
+
+ + \ No newline at end of file diff --git a/archive.php b/archive.php new file mode 100644 index 00000000..22ae223b --- /dev/null +++ b/archive.php @@ -0,0 +1,75 @@ + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+

+
+ +
+

+ +
+
+ + + +
+
+ + + \ No newline at end of file diff --git a/author.php b/author.php new file mode 100644 index 00000000..261b9a71 --- /dev/null +++ b/author.php @@ -0,0 +1,74 @@ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+

+
+ +
+

+ +
+
+ + + +
+
+ + + \ No newline at end of file diff --git a/category.php b/category.php new file mode 100644 index 00000000..93e7c204 --- /dev/null +++ b/category.php @@ -0,0 +1,64 @@ + + +
+
+ + + +
' ); + ?> + + + + + + + + + + + + + + + +
+
+

+
+ +
+

+ +
+
+ + + + +
+ + + \ No newline at end of file diff --git a/comments.php b/comments.php new file mode 100644 index 00000000..058b1c94 --- /dev/null +++ b/comments.php @@ -0,0 +1,76 @@ + +
+ +

+
+ + + + + +

+ ' . get_the_title() . '' ); + ?> +

+ + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> + + + +
    + '_s_comment' ) ); + ?> +
+ + 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?> + + + + + + +

+ + + + + diff --git a/content-aside.php b/content-aside.php new file mode 100644 index 00000000..543eed61 --- /dev/null +++ b/content-aside.php @@ -0,0 +1,36 @@ + + +
> +
+

+
+ + +
+ +
+ +
+ →', '_s' ) ); ?> + '' ) ); ?> +
+ + +
+ + + | + + + | ', '' ); ?> +
+
diff --git a/content-gallery.php b/content-gallery.php new file mode 100644 index 00000000..a8ca0ab8 --- /dev/null +++ b/content-gallery.php @@ -0,0 +1,86 @@ + + +
> +
+

+ + +
+ + +
+ +
+ +
+ + →', '_s' ) ); ?> + + + $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) ); + if ( $images ) : + $total_images = count( $images ); + $image = array_shift( $images ); + $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' ); + ?> + + + +

%2$s photo.', 'This gallery contains %2$s photos.', $total_images, '_s' ), + 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', '_s' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', + number_format_i18n( $total_images ) + ); ?>

+ + + + '' ) ); ?> +
+ + +
+ + + + + + | + + + + + + + | + + + + + + | + + + ', '' ); ?> +
+
diff --git a/content-image.php b/content-image.php new file mode 100644 index 00000000..43170b5c --- /dev/null +++ b/content-image.php @@ -0,0 +1,30 @@ + + +
> +
+

+
+ +
+ →', '_s' ) ); ?> + '' ) ); ?> +
+ +
+ + + | + + + | ', '' ); ?> +
+
diff --git a/content-page.php b/content-page.php new file mode 100644 index 00000000..7ff985b9 --- /dev/null +++ b/content-page.php @@ -0,0 +1,20 @@ + + +
> +
+

+
+ +
+ + '' ) ); ?> + ', '' ); ?> +
+
diff --git a/content-single.php b/content-single.php new file mode 100644 index 00000000..9a18f91e --- /dev/null +++ b/content-single.php @@ -0,0 +1,59 @@ + + +
> +
+

+ + +
+ +
+ + '' ) ); ?> +
+ +
+ permalink.', '_s' ); + } else { + $meta_text = __( 'Bookmark the permalink.', '_s' ); + } + + } else { + // But this blog has loads of categories so we should probably display them here + if ( '' != $tag_list ) { + $meta_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', '_s' ); + } else { + $meta_text = __( 'This entry was posted in %1$s. Bookmark the permalink.', '_s' ); + } + + } // end check for categories on this blog + + printf( + $meta_text, + $category_list, + $tag_list, + get_permalink(), + the_title_attribute( 'echo=0' ) + ); + ?> + + ', '' ); ?> +
+
diff --git a/content.php b/content.php new file mode 100644 index 00000000..e089fdfd --- /dev/null +++ b/content.php @@ -0,0 +1,62 @@ + + +
> +
+

+ + + + +
+ + +
+ +
+ +
+ →', '_s' ) ); ?> + '' ) ); ?> +
+ + +
+ + + + + + | + + + + + + + | + + + + + + | + + + ', '' ); ?> +
+
diff --git a/footer.php b/footer.php new file mode 100644 index 00000000..bbeddaf5 --- /dev/null +++ b/footer.php @@ -0,0 +1,27 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/functions.php b/functions.php new file mode 100644 index 00000000..53e7bc3f --- /dev/null +++ b/functions.php @@ -0,0 +1,306 @@ + __( 'Primary Menu', '_s' ), + ) ); + + /** + * Add support for the Aside and Gallery Post Formats + */ + add_theme_support( 'post-formats', array( 'aside', 'image', 'gallery' ) ); +} +endif; // _s_setup + +/** + * Tell WordPress to run _s_setup() when the 'after_setup_theme' hook is run. + */ +add_action( 'after_setup_theme', '_s_setup' ); + +/** + * Set a default theme color array for WP.com. + */ +$themecolors = array( + 'bg' => 'ffffff', + 'border' => 'eeeeee', + 'text' => '444444', +); + +/** + * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. + */ +function _s_page_menu_args( $args ) { + $args['show_home'] = true; + return $args; +} +add_filter( 'wp_page_menu_args', '_s_page_menu_args' ); + +/** + * Register widgetized area and update sidebar with default widgets + */ +function _s_widgets_init() { + register_sidebar( array( + 'name' => __( 'Sidebar 1', '_s' ), + 'id' => 'sidebar-1', + 'before_widget' => '", + 'before_title' => '

', + 'after_title' => '

', + ) ); + + register_sidebar( array( + 'name' => __( 'Sidebar 2', '_s' ), + 'id' => 'sidebar-2', + 'description' => __( 'An optional second sidebar area', '_s' ), + 'before_widget' => '", + 'before_title' => '

', + 'after_title' => '

', + ) ); +} +add_action( 'init', '_s_widgets_init' ); + +if ( ! function_exists( '_s_content_nav' ) ): +/** + * Display navigation to next/previous pages when applicable + * + * @since _s 1.0 + */ +function _s_content_nav( $nav_id ) { + global $wp_query; + + ?> + + comment_type ) : + case 'pingback' : + case 'trackback' : + ?> +
  • +

    + +
  • id="li-comment-"> +
    +
    +
    + + says:', '_s' ), sprintf( '%s', get_comment_author_link() ) ); ?> +
    + comment_approved == '0' ) : ?> + +
    + + + +
    + +
    + +
    + $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> +
    +
    + + Posted on ', '_s' ), + esc_url( get_permalink() ), + esc_attr( get_the_time() ), + esc_attr( get_the_date( 'c' ) ), + esc_html( get_the_date() ), + esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), + esc_attr( sprintf( __( 'View all posts by %s', '_s' ), get_the_author() ) ), + esc_html( get_the_author() ) + ); +} +endif; + +/** + * Adds custom classes to the array of body classes. + * + * @since _s 1.0 + */ +function _s_body_classes( $classes ) { + // Adds a class of single-author to blogs with only 1 published author + if ( ! is_multi_author() ) { + $classes[] = 'single-author'; + } + + return $classes; +} +add_filter( 'body_class', '_s_body_classes' ); + +/** + * Returns true if a blog has more than 1 category + * + * @since _s 1.0 + */ +function _s_categorized_blog() { + if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { + // Create an array of all the categories that are attached to posts + $all_the_cool_cats = get_categories( array( + 'hide_empty' => 1, + ) ); + + // Count the number of categories that are attached to the posts + $all_the_cool_cats = count( $all_the_cool_cats ); + + set_transient( 'all_the_cool_cats', $all_the_cool_cats ); + } + + if ( '1' != $all_the_cool_cats ) { + // This blog has more than 1 category so _s_categorized_blog should return true + return true; + } else { + // This blog has only 1 category so _s_categorized_blog should return false + return false; + } +} + +/** + * Flush out the transients used in _s_categorized_blog + * + * @since _s 1.0 + */ +function _s_category_transient_flusher() { + // Like, beat it. Dig? + delete_transient( 'all_the_cool_cats' ); +} +add_action( 'edit_category', '_s_category_transient_flusher' ); +add_action( 'save_post', '_s_category_transient_flusher' ); + +/** + * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages + */ +function _s_enhanced_image_navigation( $url ) { + global $post, $wp_rewrite; + + $id = (int) $post->ID; + $object = get_post( $id ); + if ( wp_attachment_is_image( $post->ID ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) ) + $url = $url . '#main'; + + return $url; +} +add_filter( 'attachment_link', '_s_enhanced_image_navigation' ); + diff --git a/header.php b/header.php new file mode 100644 index 00000000..93d4df49 --- /dev/null +++ b/header.php @@ -0,0 +1,75 @@ + section and everything up till
    + * + * @package _s + * @since _s 1.0 + */ +?> + + + + +> + + + + +<?php + /* + * Print the <title> tag based on what is being viewed. + */ + global $page, $paged; + + wp_title( '|', true, 'right' ); + + // Add the blog name. + bloginfo( 'name' ); + + // Add the blog description for the home/front page. + $site_description = get_bloginfo( 'description', 'display' ); + if ( $site_description && ( is_home() || is_front_page() ) ) + echo " | $site_description"; + + // Add a page number if necessary: + if ( $paged >= 2 || $page >= 2 ) + echo ' | ' . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) ); + + ?> + + + + + + + + + +> +
    + + + +
    \ No newline at end of file diff --git a/image.php b/image.php new file mode 100644 index 00000000..a566724e --- /dev/null +++ b/image.php @@ -0,0 +1,110 @@ + + +
    +
    + + + +
    > +
    +

    + + + + +
    + +
    + +
    +
    + $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); + foreach ( $attachments as $k => $attachment ) { + if ( $attachment->ID == $post->ID ) + break; + } + $k++; + // If there is more than 1 attachment in a gallery + if ( count( $attachments ) > 1 ) { + if ( isset( $attachments[ $k ] ) ) + // get the URL of the next image attachment + $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); + else + // or get the URL of the first image attachment + $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); + } else { + // or, if there's only 1 image, get the URL of the image + $next_attachment_url = wp_get_attachment_url(); + } + ?> + + ID, array( $attachment_size, $attachment_size ) ); // filterable image width with, essentially, no limit for image height. + ?> +
    + + post_excerpt ) ) : ?> +
    + +
    + +
    + + + '' ) ); ?> + +
    + +
    + + Post a comment or leave a trackback: Trackback URL.', '_s' ), get_trackback_url() ); ?> + + Trackback URL.', '_s' ), get_trackback_url() ); ?> + + post a comment.', '_s' ); ?> + + + + ', '' ); ?> +
    +
    + + + + + +
    +
    + + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 00000000..8ea40b19 --- /dev/null +++ b/index.php @@ -0,0 +1,58 @@ + + +
    +
    + + + + + + + + + + + + + + + + +
    +
    +

    +
    + +
    +

    + +
    +
    + + + +
    +
    + + + \ No newline at end of file diff --git a/js/html5.js b/js/html5.js new file mode 100644 index 00000000..6dd03a4c --- /dev/null +++ b/js/html5.js @@ -0,0 +1,3 @@ +// html5shiv MIT @rem remysharp.com/html5-enabling-script +// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector +/*@cc_on(function(a,b){function r(a){var b=-1;while(++b";return a.childNodes.length!==1}())){a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=l.firstChild,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){if(a+""===undefined)return"";var d=-1,e=a.length,f,g=[];while(++d + +
    +
    + + + + + + + + + +
    +
    + + + \ No newline at end of file diff --git a/readme.txt b/readme.txt new file mode 100644 index 00000000..ed8b313a --- /dev/null +++ b/readme.txt @@ -0,0 +1 @@ +== Changelog == \ No newline at end of file diff --git a/rtl.css b/rtl.css new file mode 100644 index 00000000..5382189a --- /dev/null +++ b/rtl.css @@ -0,0 +1,17 @@ +/* +Theme Name: _s + +Adding support for language written in a Right To Left (RTL) direction is easy - +it's just a matter of overwriting all the horizontal positioning attributes +of your CSS stylesheet in a separate stylesheet file named rtl.css. + +http://codex.wordpress.org/Right_to_Left_Language_Support + +*/ + +/* +body { + direction: rtl; + unicode-bidi: embed; +} +*/ \ No newline at end of file diff --git a/search.php b/search.php new file mode 100644 index 00000000..a0b10b08 --- /dev/null +++ b/search.php @@ -0,0 +1,50 @@ + + +
    +
    + + + + + + + + + + + + + + + + + + +
    +
    +

    +
    + +
    +

    + +
    +
    + + + +
    +
    + + + \ No newline at end of file diff --git a/sidebar.php b/sidebar.php new file mode 100644 index 00000000..9c0d5f50 --- /dev/null +++ b/sidebar.php @@ -0,0 +1,40 @@ + + + + + + \ No newline at end of file diff --git a/single.php b/single.php new file mode 100644 index 00000000..ea5cdd8f --- /dev/null +++ b/single.php @@ -0,0 +1,34 @@ + + +
    +
    + + + + + + + + + + + + + +
    +
    + + + \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 00000000..8e6bd495 --- /dev/null +++ b/style.css @@ -0,0 +1,12 @@ +/* +Theme Name: _s +Theme URI: http://wpcom-themes.svn.automattic.com/_s +Author: Automattic +Author URI: http://automattic.com/ +Description: The Automattic Theme Team starter theme that underscores all our work. +Version: 1.0-wpcom +License: GNU General Public License +License URI: license.txt +Tags: +*/ + diff --git a/tag.php b/tag.php new file mode 100644 index 00000000..ec431fb7 --- /dev/null +++ b/tag.php @@ -0,0 +1,66 @@ + + +
    +
    + + + +
    ' ); + ?> + + + + + + + + + + + + + + + + + +
    +
    +

    +
    + +
    +

    + +
    +
    + + + +
    + + + + \ No newline at end of file