Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: f93dfcfec2
...
compare: 9160598c23
  • 6 commits
  • 13 files changed
  • 0 commit comments
  • 1 contributor
View
2  archive-mfields_bookmark.php
@@ -45,7 +45,7 @@
<?php
- Nighthawk::set_columns( array(
+ Nighthawk::set_table_columns( array(
array(
'label' => __( 'Post Title', 'nighthawk' ),
'class' => 'post-title',
View
2  comments.php
@@ -25,7 +25,7 @@
*/
if ( post_password_required() ) {
if ( have_comments() )
- echo '<p class="nopassword">' . sprintf( __( 'This %1$s is password protected. Enter the password to view any comments.', 'nighthawk' ), nighthawk_post_label_singular() ) . '</p>';
+ echo '<p class="nopassword">' . sprintf( __( 'This %1$s is password protected. Enter the password to view any comments.', 'nighthawk' ), Nighthawk::post_label() ) . '</p>';
return;
}
View
2  footer.php
@@ -43,7 +43,7 @@
}
$count = count( $active );
if ( 0 < $count ) {
- echo '<div id="widgets" class="count-' . $count . '" role="complementary">';
+ echo '<div id="footer-widgets" class="footer-widgets footer-widgets-count-' . $count . '" role="complementary">';
foreach ( $active as $order => $area ) {
echo '<div id="' . esc_attr( $area ) . '" class="area area-' . ( 1 + $order ) . '">' . "\n";
dynamic_sidebar( $area . '-footer-widget-area' );
View
991 functions.php
@@ -2,33 +2,6 @@
/**
* Functions
*
- * This file defines three specific types of functions.
- * Please see the @type tag in each function's docblock
- * to determine how the function should be used.
- *
- * 1. Template Tags
- *
- * Any function defined in this this section may be used
- * freely in appropriate template files. Please see
- * each function's documentation for intended usage.
- *
- * 2. Core Callbacks
- *
- * Functions of this type are intended to be used as callbacks
- * for WordPress core functions and template tags. They are not
- * to be used on their own.
- *
- * 3. Private Functions.
- *
- * The functions defined below are deemed to be private
- * meaning that they should not be used in any template file for
- * any reason. These functions may or may not be presnt in
- * future releases of the Nighthawk theme. If you feel that you
- * absolutely need to use one of them it is suggested that you
- * copy the full function into your child theme's functions.php file
- * and rename it. This will ensure that it always exists in your
- * installation regardless of how Nighthawk changes.
- *
* @package Nighthawk
* @author Michael Fields <michael@mfields.org>
* @copyright Copyright (c) 2011, Michael Fields
@@ -36,80 +9,461 @@
* @since Nighthawk 1.0
*/
-define( 'NIGHTHAWK_VERSION', '0.3DEV' );
+class Nighthawk {
-/**
- * Theme Setup
- *
- * If you would like to customize the theme setup you
- * are encouraged to adopt the following process.
- *
- * <ol>
- * <li>Create a child theme with a functions.php file.</li>
- * <li>Create a new function named mytheme_nighthawk_setup().</li>
- * <li>Hook this function into the 'after_setup_theme' action at or after 11.</li>
- * <li>call remove_filter(), remove_action() and/or remove_theme_support() as needed.</li>
- * </ol>
- *
- * @return void
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_setup() {
-
- if ( is_admin() ) {
- require_once get_template_directory() . '/admin.php';
- }
-
- global $content_width;
- if ( ! isset( $content_width ) ) {
- $content_width = 700;
- }
-
- load_theme_textdomain( 'nighthawk', get_template_directory() . '/languages' );
-
- add_theme_support( 'menus' );
- add_theme_support( 'post-formats', array( 'image', 'status' ) );
- add_theme_support( 'post-thumbnails' );
- add_theme_support( 'automatic-feed-links' );
- add_custom_background();
- add_editor_style( 'style-editor.css' );
-
- /* A few extras for pages. */
- add_post_type_support( 'page', 'excerpt' );
- add_post_type_support( 'page', 'thumbnail' );
-
- /* Image sizes. */
- set_post_thumbnail_size( 150, 150, false );
- add_image_size( 'nighthawk_detail', 70, 70, true );
-
- /* Navigation menus. */
- register_nav_menus( array( 'primary' => 'Primary', 'secondary' => 'Secondary' ) );
-
- /* WordPress Hooking into WordPress */
- add_filter( 'get_the_author_description', 'wptexturize' );
- add_filter( 'get_the_author_description', 'convert_chars' );
- add_filter( 'get_the_author_description', 'wpautop' );
-
- /* WordPress Core. */
- add_filter( 'edit_post_link', '_nighthawk_edit_post_link', 9, 2 );
- add_filter( 'embed_oembed_html', '_nighthawk_oembed_dataparse', 10, 4 );
- add_filter( 'embed_googlevideo', '_nighthawk_oembed_dataparse', 10, 2 );
- add_filter( 'excerpt_more', '_nighthawk_excerpt_more_auto' );
- add_filter( 'post_class', '_nighthawk_post_class' );
- add_filter( 'the_password_form', '_nighthawk_password_form' );
- add_action( 'widget_title', '_nighthawk_calendar_widget_title', 10, 3 );
- add_action( 'widgets_init', '_nighthawk_widgets_init' );
- add_action( 'wp_loaded', '_nighthawk_custom_image_header' );
- add_action( 'template_redirect', '_nighthawk_post_labels_init' );
- add_action( 'wp_enqueue_scripts', '_nighthawk_comment_reply_js' );
- add_action( 'wp_enqueue_scripts', '_nighthawk_heading_font_css' );
- add_action( 'wp_enqueue_scripts', '_nighthawk_widget_dropdowns_scripts' );
-
- add_filter( 'syntaxhighlighter_themes', '_nighthawk_syntaxhighlighter_theme' );
+ const prefix = 'Nighthawk::';
+
+ /**
+ * Table Columns.
+ *
+ * @since Nighthawk 1.0
+ */
+ static private $columns = null;
+
+ /**
+ * Init.
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function init() {
+ add_action( 'after_setup_theme', array( __class__, 'setup' ) );
+
+ self::$columns = array(
+ array(
+ 'label' => __( 'Post Title', 'nighthawk' ),
+ 'class' => 'post-title',
+ 'callback' => 'nighthawk_td_title',
+ ),
+ array(
+ 'label' => __( 'Comment Count', 'nighthawk' ),
+ 'class' => 'comment-count',
+ 'callback' => 'nighthawk_td_comment_count',
+ ),
+ array(
+ 'label' => __( 'Comment Link', 'nighthawk' ),
+ 'class' => 'comment-respond icon',
+ 'callback' => 'nighthawk_td_comment_icon',
+ ),
+ );
+ }
+
+ /**
+ * Setup Nighthawk
+ *
+ * If you would like to customize the theme setup you
+ * are encouraged to adopt the following process.
+ *
+ * <ol>
+ * <li>Create a child theme with a functions.php file.</li>
+ * <li>Create a new function named mytheme_nighthawk_setup().</li>
+ * <li>Hook this function into the 'after_setup_theme' action at or after 11.</li>
+ * <li>call remove_filter(), remove_action() and/or remove_theme_support() as needed.</li>
+ * </ol>
+ *
+ * @return void
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function setup() {
+ if ( is_admin() )
+ require_once get_template_directory() . '/admin.php';
+
+ global $content_width;
+ if ( ! isset( $content_width ) )
+ $content_width = 700;
+
+ load_theme_textdomain( 'nighthawk', get_template_directory() . '/languages' );
+
+ add_editor_style( 'style-editor.css' );
+
+ add_theme_support( 'menus' );
+ add_theme_support( 'post-formats', array( 'image', 'status' ) );
+ add_theme_support( 'post-thumbnails' );
+ add_theme_support( 'automatic-feed-links' );
+
+ add_custom_background();
+
+ /* A few extras for pages. */
+ add_post_type_support( 'page', 'excerpt' );
+ add_post_type_support( 'page', 'thumbnail' );
+
+ /* Image sizes. */
+ set_post_thumbnail_size( 150, 150, false );
+ add_image_size( 'nighthawk_detail', 70, 70, true );
+
+ /* Navigation menus. */
+ register_nav_menus( array( 'primary' => 'Primary', 'secondary' => 'Secondary' ) );
+
+ add_filter( 'get_the_author_description', 'wptexturize' );
+ add_filter( 'get_the_author_description', 'convert_chars' );
+ add_filter( 'get_the_author_description', 'wpautop' );
+
+ add_action( 'comment_form_after', self::prefix . 'commentform_after' );
+ add_action( 'comment_form_before', self::prefix . 'commentform_before' );
+ add_filter( 'edit_post_link', self::prefix . 'edit_post_link', 9, 2 );
+ add_filter( 'embed_oembed_html', self::prefix . 'oembed_dataparse', 10, 4 );
+ add_filter( 'embed_googlevideo', self::prefix . 'oembed_dataparse', 10, 2 );
+ add_filter( 'excerpt_more', self::prefix . 'excerpt_more_auto' );
+ add_filter( 'post_class', self::prefix . 'post_class' );
+ add_action( 'template_redirect', self::prefix . 'post_labels_init' );
+ add_filter( 'the_password_form', self::prefix . 'password_form' );
+ add_action( 'the_title', self::prefix . 'filter_post_title' );
+ add_action( 'widgets_init', self::prefix . 'register_widget_areas' );
+ add_action( 'wp_enqueue_scripts', self::prefix . 'script_comment_reply' );
+ add_action( 'wp_enqueue_scripts', self::prefix . 'css_heading_font' );
+ add_action( 'wp_enqueue_scripts', self::prefix . 'css_syntaxhighlighter' );
+ add_action( 'wp_enqueue_scripts', self::prefix . 'script_dropdown_widgets' );
+ add_action( 'wp_loaded', self::prefix . 'custom_header_config' );
+
+ add_filter( 'syntaxhighlighter_themes', self::prefix . 'syntaxhighlighter_theme' );
+ }
+ /**
+ * Configuration for enabling the WordPress custom header image feature.
+ *
+ * @since Nighthawk 1.0
+ */
+ function custom_header_config() {
+ define( 'HEADER_TEXTCOLOR', '777' );
+ define( 'HEADER_IMAGE', get_template_directory_uri() . '/images/lanterns.jpg' );
+ define( 'HEADER_IMAGE_WIDTH', 1000 );
+ define( 'HEADER_IMAGE_HEIGHT', 288 );
+ define( 'NO_HEADER_TEXT', true );
+
+ add_custom_image_header( '_nighthawk_custom_image_header_live', '_nighthawk_custom_image_header_admin' );
+ }
+
+ /**
+ * Comment Reply Script.
+ *
+ * Enqueue comment reply script on singular views.
+ *
+ * In the event that a user has threaded comments enabled
+ * for their installation this function will include the
+ * appropriate javascript files on single views where
+ * commenting is enabled.
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function script_comment_reply() {
+ if ( is_singular() && comments_open() ) {
+ if ( get_option( 'thread_comments' ) )
+ wp_enqueue_script( 'comment-reply' );
+ }
+ }
+
+ /**
+ * Dropdown Widgets Script.
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function script_dropdown_widgets() {
+ wp_enqueue_script(
+ 'dropdown-widgets',
+ get_template_directory_uri() . '/inc/dropdowns.js',
+ array( 'jquery' ),
+ '0.1',
+ true
+ );
+ }
+
+ /**
+ * Heading Font Styles.
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function css_heading_font() {
+ wp_enqueue_style(
+ 'nighthawk-cabin',
+ 'http://fonts.googleapis.com/css?family=Cabin:regular,regularitalic,bold,bolditalic',
+ array(),
+ '1'
+ );
+ }
+
+ /**
+ * SyntaxHighlighter Evolved Styles.
+ *
+ * @see http://wordpress.org/extend/plugins/syntaxhighlighter/
+ * @since Nighthawk 1.0
+ */
+ public static function css_syntaxhighlighter() {
+ wp_register_style(
+ 'syntaxhighlighter-theme-nighthawk',
+ get_template_directory_uri() . '/style-syntax-highlighter.css',
+ array( 'syntaxhighlighter-core' ),
+ '1'
+ );
+ }
+
+ /**
+ * Register Widgetized Areas.
+ *
+ * @return void
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function register_widget_areas() {
+ register_sidebar( array(
+ 'name' => 'Dropdowns',
+ 'id' => 'dropdowns',
+ 'description' => 'Dropdowns that appear at the top of the page on all views.',
+ 'before_widget' => '<div id="%1$s" class="dropdown widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>',
+ ) );
+
+ /* Area 1 - Left column below content. */
+ register_sidebar( array(
+ 'name' => __( 'Bottom 1', 'nighthawk' ),
+ 'id' => 'first-footer-widget-area',
+ 'description' => __( 'The first footer widget area', 'nighthawk' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>',
+ ) );
+
+ /* Area 2 - Middle column below content. */
+ register_sidebar( array(
+ 'name' => __( 'Bottom 2', 'nighthawk' ),
+ 'id' => 'second-footer-widget-area',
+ 'description' => __( 'The second footer widget area', 'nighthawk' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>',
+ ) );
+
+ /* Area 3, Right column bottom of content . */
+ register_sidebar( array(
+ 'name' => __( 'Bottom 3', 'nighthawk' ),
+ 'id' => 'third-footer-widget-area',
+ 'description' => __( 'The third footer widget area', 'nighthawk' ),
+ 'before_widget' => '<div id="%1$s" class="widget %2$s">',
+ 'after_widget' => '</div>',
+ 'before_title' => '<h3 class="widget-title">',
+ 'after_title' => '</h3>',
+ ) );
+ }
+
+ /**
+ * Add custom class names to individual posts.
+ *
+ * This filter is attached to the 'post_class' hook
+ * @see Nighthawk::setup()
+ *
+ * @param array $classes All classes for the post container.
+ * @return array Modified classes for the post container.
+ *
+ * @access private
+ * @since Nighthawk 1.0
+ */
+ public static function post_class( $classes ) {
+ if ( is_search() )
+ return array( 'search-result', 'box' );
+
+ $classes[] = 'entry';
+ $classes[] = 'box';
+
+ $featured_image = get_the_post_thumbnail();
+ if ( ! empty( $featured_image ) )
+ $classes[] = 'has-featured-image';
+
+ return array_unique( $classes );
+ }
+
+ /**
+ * Excerpt More (auto).
+ *
+ * In cases where a post does not have an excerpt defined
+ * WordPress will append the string "[...]" to a shortened
+ * version of the post_content field. Nighthawk will replace
+ * this string with an ellipsis.
+ *
+ * This filter is attached to the 'excerpt_more' hook
+ * @see Nighthawk::setup()
+ *
+ * @param string $more unused.
+ * @return string An ellipsis followed by a link to the single post.
+ *
+ * @access private
+ * @since Nighthawk 1.0
+ */
+ public static function excerpt_more_auto( $more ) {
+ return ' &hellip;';
+ }
+
+ /**
+ * Post label.
+ *
+ * Returns a noun representing the type or format of the global
+ * post object. This function is used internally by the
+ * nighthawk_entry_meta_taxonomy() function to create a sentence much
+ * like the following: "This Status Update is filed under News."
+ * where "Status Update" is the post label and "News" is the category.
+ *
+ * @uses NighthawkPostLabel::get_label()
+ *
+ * @param string $type Optional. May be either "singular" or "plural". Defaults to "singular".
+ * @return string A noun representing the global post object.
+ *
+ * @access public
+ * @since Nighthawk 1.0
+ */
+ public static function post_label( $type = 'singular' ) {
+ if ( class_exists( 'NighthawkPostLabel' ) )
+ return NighthawkPostLabel::get( $type );
+ else if ( 'singular' == $type )
+ return __( 'entry', 'nighthawk' );
+ else
+ return __( 'entries', 'nighthawk' );
+ }
+
+ /**
+ * Enclose embedded media in a div.
+ *
+ * Wrapping all flash embeds in a div allows for easier
+ * styling with CSS media queries.
+ *
+ * @todo Document parameters.
+ *
+ * @access private
+ * @since Nighthawk 1.0
+ */
+ public static function oembed_dataparse( $cache, $url, $attr = '', $post_ID = '' ) {
+ return '<div class="embed">' . $cache . '</div>';
+ }
+
+ /**
+ * SyntaxHighlighter Evolved Support.
+ *
+ * Registers a custom theme with the SyntaxHighlighter Evolved plugin.
+ *
+ * {@link http://wordpress.org/extend/plugins/syntaxhighlighter/ SyntaxHighlighter Evolved }
+ *
+ * @param array $themes All themes registered with the SyntaxHighlighter Evolved plugin.
+ * @return array Same list with custom theme appended.
+ *
+ * @access private
+ * @since Nighthawk 1.0
+ */
+ public static function syntaxhighlighter_theme( $themes ) {
+ $themes['nighthawk'] = 'Nighthawk';
+ return $themes;
+ }
+
+ public static function filter_post_title( $title ) {
+ if ( ! is_singular() )
+ return $title;
+
+ if ( empty( $title ) && 'post' == get_post_type() )
+ $title = ucfirst( self::post_label() ); // todo: ucfirst for English only if possible.
+
+ return $title;
+ }
+ public static function commentform_before() {
+ echo '<div class="box">';
+ }
+ public static function commentform_after() {
+ echo '</div>';
+ }
+ public static function post_labels_init() {
+ require_once get_template_directory() . '/inc/post-labels.php';
+ NighthawkPostLabel::init();
+ }
+
+ /**
+ * Edit post link filter.
+ *
+ * Modifies the output of WordPress
+ * core function edit_post_link();
+ *
+ * @param string $html Default anchor tag generated by WordPress.
+ * @param int $ID Post ID.
+ *
+ * @access private
+ * @since Nighthawk 1.0
+ */
+ public static function edit_post_link( $html, $ID ) {
+ return '<a class="post-edit-link" href="' . esc_url( get_edit_post_link( $ID ) ) . '" title="' . esc_attr( sprintf( __( 'Edit this %1$s', 'nighthawk' ), self::post_label() ) ) . '">' . esc_html( wp_strip_all_tags( $html ) ) . '</a>';
+ }
+
+ /**
+ * Password Form.
+ *
+ * @param string $form Default password-protected post from.
+ * @return string Custom form from template.
+ *
+ * @access private
+ * @since Nighthawk 1.0
+ */
+ public static function password_form( $form ) {
+ ob_start();
+ get_template_part( 'password-protected-post-form' );
+ $form = ob_get_contents();
+ ob_end_clean();
+ return $form;
+ }
+
+ /**
+ * Search Form ID.
+ *
+ * @return string ID attribute for search form.
+ *
+ * @since Nighthawk 1.0
+ */
+ public static function searchform_id() {
+ static $id = 0;
+ return 'search-form-' . $id++;
+ }
+
+ /**
+ * Total Posts.
+ *
+ * @return int ID attribute for search form.
+ *
+ * @since Nighthawk 1.0
+ */
+ static public function post_total() {
+ global $wp_query;
+ if ( isset( $wp_query->found_posts ) )
+ return (int) $wp_query->found_posts;
+ return 0;
+ }
+
+ /**
+ * Get table columns.
+ *
+ * @return int ID attribute for search form.
+ *
+ * @since Nighthawk 1.0
+ */
+ static public function get_table_columns() {
+ if ( current_user_can( 'edit_posts' ) ) {
+ $edit = array(
+ 'label' => __( 'Edit', 'nighthawk' ),
+ 'class' => 'edit-post icon',
+ 'callback' => 'nighthawk_td_edit',
+ );
+ array_unshift( self::$columns, $edit );
+ }
+ return (array) self::$columns;
+ }
+
+ /**
+ * Set table columns.
+ *
+ * @return array Table columns configuration.
+ *
+ * @since Nighthawk 1.0
+ */
+ static public function set_table_columns( $columns = null ) {
+ self::$columns = $columns;
+ }
}
-add_action( 'after_setup_theme', '_nighthawk_setup' );
+
+Nighthawk::init();
/**
* Summary Meta.
@@ -144,7 +498,7 @@ function nighthawk_summary_meta( $before = '', $after = '', $print = true ) {
if ( isset( $post_type->name ) && isset( $post_type->label ) && isset( $post_type->labels->singular_name ) ) {
$feed_url = get_post_type_archive_feed_link( $post_type->name );
$feed_title = sprintf( __( 'Get updated whenever new %1$s are published.', 'nighthawk' ), $post_type->label );
- $sentence = sprintf( _n( 'Only one %3$s found in this archive.', 'There are %1$s %2$s in this archive.', $total, 'nighthawk' ), number_format_i18n( $total ), nighthawk_post_label_plural(), nighthawk_post_label_singular() );
+ $sentence = sprintf( _n( 'Only one %3$s found in this archive.', 'There are %1$s %2$s in this archive.', $total, 'nighthawk' ), number_format_i18n( $total ), Nighthawk::post_label( 'plural' ), Nighthawk::post_label() );
$sentence = apply_filters( 'nighthawk_summary_meta_post_type_archive', $sentence, $post_type );
$sentence = apply_filters( "nighthawk_summary_meta_{$post_type->name}_archive", $sentence, $post_type );
}
@@ -158,7 +512,7 @@ function nighthawk_summary_meta( $before = '', $after = '', $print = true ) {
}
if ( isset( $parent->ID ) && isset( $parent->post_title ) ) {
$parent_link = '<a href="' . get_permalink( $parent->ID ) . '">' . apply_filters( 'the_title', $parent->post_title ) . '</a>';
- $label = nighthawk_post_label_singular();
+ $label = Nighthawk::post_label();
$sentence = sprintf( __( 'This %1$s is attached to %2$s.', 'nighthawk' ), $label, $parent_link );
$sentence = apply_filters( 'nighthawk_summary_file', $sentence );
}
@@ -174,8 +528,8 @@ function nighthawk_summary_meta( $before = '', $after = '', $print = true ) {
switch ( $term->taxonomy ) {
case 'post_format' :
- $feed_title = sprintf( __( 'Get updated whenever a new %1$s is published.', 'nighthawk' ), nighthawk_post_label_singular() );
- $sentence = sprintf( _n( 'This site contains one %2$s.', 'This site contains %1$s %3$s.', $total, 'nighthawk' ), number_format_i18n( $total ), nighthawk_post_label_singular(), nighthawk_post_label_plural() );
+ $feed_title = sprintf( __( 'Get updated whenever a new %1$s is published.', 'nighthawk' ), Nighthawk::post_label() );
+ $sentence = sprintf( _n( 'This site contains one %2$s.', 'This site contains %1$s %3$s.', $total, 'nighthawk' ), number_format_i18n( $total ), Nighthawk::post_label(), Nighthawk::post_label( 'plural' ) );
break;
default :
$feed_title = sprintf( __( 'Subscribe to this %1$s', 'nighthawk' ), $taxonomy_name );
@@ -230,7 +584,7 @@ function nighthawk_entry_meta_taxonomy() {
return;
}
- $label = nighthawk_post_label_singular();
+ $label = Nighthawk::post_label();
#$label_url = get_post_format_link( get_post_format() );
$label_url = get_permalink();
@@ -242,7 +596,7 @@ function nighthawk_entry_meta_taxonomy() {
$categories = get_the_category_list( ', ' );
if ( ! empty( $label ) && ! empty( $label_url ) ) {
- $plural = nighthawk_post_label_plural();
+ $plural = Nighthawk::post_label( 'plural' );
$title = '';
if ( ! empty( $plural ) ) {
$title = ' title="' . sprintf( esc_attr__( 'View all %1$s', 'nighthawk' ), strtolower( $plural ) ) . '"';
@@ -279,54 +633,6 @@ function nighthawk_entry_meta_taxonomy() {
}
/**
- * Post label - singular.
- *
- * Returns a noun representing the type or format of the global
- * post object. This function is used internally by the
- * nighthawk_entry_meta_taxonomy() function to create a sentence much
- * like the following: "This Status Update is filed under News."
- * where "Status Update" is the post label and "News" is the category.
- *
- * @param string $default Value to return if no label can be calculated.
- * @return string A singular noun representing the global post object.
- *
- * @access public
- * @since 1.0
- */
-function nighthawk_post_label_singular( $default = '' ) {
- $labels = Mfields_Post_Label::get_label();
- if ( isset( $labels[0] ) ) {
- return $labels[0];
- }
- return $default;
-}
-
-/**
- * Post label - plural.
- *
- * Returns a noun representing the type or format of the global
- * post object. This function is used internally by the
- * nighthawk_summary_meta() function to create a title attribute
- * for the "Subscribe" link that reads something like:
- * "This image is part of the gallery titled Taco Pictures."
- * where "image" is the post label and "Taco Pictures" is the
- * title of the parent post.
- *
- * @param string $default Value to return if no label can be calculated.
- * @return string A singular noun representing the global post object.
- *
- * @access public
- * @since 1.0
- */
-function nighthawk_post_label_plural( $default = '' ) {
- $labels = Mfields_Post_Label::get_label();
- if ( isset( $labels[1] ) ) {
- return $labels[1];
- }
- return $default;
-}
-
-/**
* Subscribe to comments checkbox.
*
* @return string
@@ -358,7 +664,7 @@ function nighthawk_subscribe_to_comments_checkbox() {
function nighthawk_subscribe_to_comments_manual_form( $before = '', $after = '', $print = true, $args = array() ) {
$args = wp_parse_args( $args, array(
'heading' => __( 'Subscribe without commenting', 'nighthawk' ),
- 'paragraph' => sprintf( __( 'Please enter your email address and click subscribe to receive an email whenever a new comment is made about this %1$s.', 'nighthawk' ), nighthawk_post_label_singular() ),
+ 'paragraph' => sprintf( __( 'Please enter your email address and click subscribe to receive an email whenever a new comment is made about this %1$s.', 'nighthawk' ), Nighthawk::post_label() ),
) );
$form = '';
global $id, $sg_subscribe, $user_email;
@@ -406,128 +712,6 @@ function nighthawk_subscribe_to_comments_manual_form( $before = '', $after = '',
}
}
-function _nighthawk_heading_font_css() {
- wp_enqueue_style(
- 'nighthawk-cabin',
- 'http://fonts.googleapis.com/css?family=Cabin:regular,regularitalic,bold,bolditalic',
- array(),
- NIGHTHAWK_VERSION
- );
-}
-
-function _nighthawk_syntax_highlighter_plugin_style() {
- wp_register_style(
- 'syntaxhighlighter-theme-nighthawk',
- get_template_directory_uri() . '/style-syntax-highlighter.css',
- array( 'syntaxhighlighter-core' ),
- '1'
- );
-}
-
-/**
- * Calendar Widget Title
- *
- * For some reason, WordPress will print a non-breaking space
- * entity wrapped in the appropriate tags for the calendar
- * widget even if the title's value is left empty by the user.
- * This function will remove the empty heading tag.
- *
- * @param string $title The value of the calendar widget's title for this instance.
- * @param unknown $instance
- * @param string $id_base
- * @return string Calendar widget title.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_calendar_widget_title( $title = '', $instance = '', $id_base = '' ) {
- if ( 'calendar' == $id_base && '&nbsp;' == $title )
- $title = '';
-
- return $title;
-}
-
-/**
- * Register Widgetized Areas.
- *
- * @return void
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_widgets_init() {
-
- register_sidebar( array(
- 'name' => 'Dropdowns',
- 'id' => 'dropdowns',
- 'description' => 'Dropdowns that appear at the top of the page on all views.',
- 'before_widget' => '<div id="%1$s" class="dropdown widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
-
- /* Area 1 - Left column below content. */
- register_sidebar( array(
- 'name' => __( 'Bottom 1', 'nighthawk' ),
- 'id' => 'first-footer-widget-area',
- 'description' => __( 'The first footer widget area', 'nighthawk' ),
- 'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
-
- /* Area 2 - Middle column below content. */
- register_sidebar( array(
- 'name' => __( 'Bottom 2', 'nighthawk' ),
- 'id' => 'second-footer-widget-area',
- 'description' => __( 'The second footer widget area', 'nighthawk' ),
- 'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
-
- /* Area 3, Right column bottom of content . */
- register_sidebar( array(
- 'name' => __( 'Bottom 3', 'nighthawk' ),
- 'id' => 'third-footer-widget-area',
- 'description' => __( 'The third footer widget area', 'nighthawk' ),
- 'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
-}
-
-/**
- * Configuration for enabling the WordPress custom header image feature.
- *
- * @return void
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_custom_image_header() {
- if ( ! defined( 'HEADER_TEXTCOLOR' ) )
- define( 'HEADER_TEXTCOLOR', '777' );
-
- if ( ! defined( 'HEADER_IMAGE' ) )
- define( 'HEADER_IMAGE', get_template_directory_uri() . '/images/lanterns.jpg' );
-
- if ( ! defined( 'HEADER_IMAGE_WIDTH' ) )
- define( 'HEADER_IMAGE_WIDTH', 1000 );
-
- if ( ! defined( 'HEADER_IMAGE_HEIGHT' ) )
- define( 'HEADER_IMAGE_HEIGHT', 288 );
-
- if ( ! defined( 'NO_HEADER_TEXT' ) )
- define( 'NO_HEADER_TEXT', true );
-
- add_custom_image_header( '_nighthawk_custom_image_header_live', '_nighthawk_custom_image_header_admin' );
-}
-
/**
* CSS for displaying custom header in public views.
*
@@ -564,51 +748,6 @@ function _nighthawk_custom_image_header_admin() {
}
/**
- * Post Classes.
- *
- * @param array $classes All classes for the post container.
- * @return array Modified classes for the post container.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_post_class( $classes ) {
- if ( is_search() )
- return array( 'search-result', 'box' );
-
- $classes[] = 'entry';
- $classes[] = 'box';
-
- $featured_image = get_the_post_thumbnail();
- if ( ! empty( $featured_image ) )
- $classes[] = 'has-featured-image';
-
- return array_unique( $classes );
-}
-
-/**
- * Excerpt More (auto).
- *
- * In cases where a post does not have an excerpt defined
- * WordPress will append the string "[...]" to a shortened
- * version of the post_content field. Nighthawk will replace
- * this string with an ellipsis followed by a link to the
- * full post.
- *
- * This filter is attached to the 'excerpt_more' hook
- * in the _nighthawk_setup() function.
- *
- * @param string $more unused.
- * @return string An ellipsis followed by a link to the single post.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_excerpt_more_auto( $more ) {
- return ' &hellip;';
-}
-
-/**
* Comment start.
*
* Prints most of a single comment.
@@ -684,206 +823,6 @@ function _nighthawk_comment_end( $comment, $args, $depth ) {
echo '</li>';
}
-/**
- * Comment Reply Script.
- *
- * Enqueue comment reply script on singular views.
- *
- * In the event that a user has threaded comments enabled
- * for their installation this function will include the
- * appropriate javascript files on single views where
- * commenting is enabled.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_comment_reply_js() {
- if ( is_singular() && comments_open() ) {
- if ( get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
- }
- }
-}
-
-/**
- * Enclose embedded media in a div.
- *
- * Wrapping all flash embeds in a div allows for easier
- * styling with CSS media queries.
- *
- * @todo Document parameters.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_oembed_dataparse( $cache, $url, $attr = '', $post_ID = '' ) {
- return '<div class="embed">' . $cache . '</div>';
-}
-
-/**
- * SyntaxHighlighter Evolved Support.
- *
- * Registers a custom theme with the SyntaxHighlighter Evolved plugin.
- *
- * {@link http://wordpress.org/extend/plugins/syntaxhighlighter/ SyntaxHighlighter Evolved }
- *
- * @param array $themes All themes registered with the SyntaxHighlighter Evolved plugin.
- * @return array Same list with custom theme appended.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_syntaxhighlighter_theme( $themes ) {
- $themes['nighthawk'] = 'Nighthawk';
- return $themes;
-}
-
-/**
- * Search Form ID.
- *
- * @return string ID attribute for search form.
- *
- * @access public
- * @since 1.0
- */
-function nighthawk_search_id() {
- static $id = 0;
- $id++;
- return 'search-form-' . $id;
-}
-
-/**
- * Password Form.
- *
- * @param string $form Default WordPress search from.
- * @return string Custom Search form.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_password_form( $form ) {
- ob_start();
- get_template_part( 'password-protected-post-form' );
- $form = ob_get_contents();
- ob_end_clean();
- return $form;
-}
-
-/**
- * Edit post link filter.
- *
- * @param string $html Default anchor tag generated by WordPress.
- * @param int $ID Post ID.
- *
- * @access private
- * @since 1.0
- */
-function _nighthawk_edit_post_link( $html, $ID ) {
- return '<a class="post-edit-link" href="' . esc_url( get_edit_post_link( $ID ) ) . '" title="' . sprintf( esc_attr__( 'Edit this %1$s', 'nighthawk' ), nighthawk_post_label_singular() ) . '">' . esc_html( wp_strip_all_tags( $html ) ) . '</a>';
-}
-
-function nighthawk_entry_template_name() {
- $template = get_post_type();
- if ( 'post' == $template ) {
- $format = get_post_format();
- if ( ! empty( $format ) ) {
- $template .= '-' . get_post_format();
- }
- }
- return sanitize_title_with_dashes( $template );
-}
-
-function _nighthawk_filter_post_title( $title ) {
- if ( ! is_singular() ) {
- return $title;
- }
- if ( empty( $title ) && 'post' == get_post_type() ) {
- $title = ucfirst( nighthawk_post_label_singular() );
- }
- return $title;
-}
-add_action( 'the_title', '_nighthawk_filter_post_title' );
-
-function _nighthawk_commentform_before() {
- echo "\n" . '<div class="box">';
-}
-add_action( 'comment_form_before', '_nighthawk_commentform_before' );
-
-function _nighthawk_commentform_after() {
- echo "\n" . '</div>';
-}
-add_action( 'comment_form_after', '_nighthawk_commentform_after' );
-
-function _nighthawk_widget_dropdowns_scripts() {
- wp_enqueue_script(
- 'dropdown-widgets',
- get_template_directory_uri() . '/inc/dropdowns.js',
- array( 'jquery' ),
- '0.1',
- true
- );
-}
-
-function _nighthawk_post_labels_init() {
- require_once get_template_directory() . '/inc/post-labels.php';
- Mfields_Post_Label::init( 'nighthawk' );
- #add_action( 'shutdown', array( 'Mfields_Post_Label', 'dump' ) );
-}
-
-Nighthawk::init();
-
-class Nighthawk {
- static private $query = null;
- static private $theme = null;
- static public function init() {
- add_action( 'template_redirect', array( __class__, 'setup' ) );
- }
- static public function post_total() {
- return (int) self::$query->total;
- }
- static public function columns() {
- if ( current_user_can( 'edit_posts' ) ) {
- $edit = array(
- 'label' => __( 'Edit', 'nighthawk' ),
- 'class' => 'edit-post icon',
- 'callback' => 'nighthawk_td_edit',
- );
- array_unshift( self::$theme->columns, $edit );
- }
- return (array) self::$theme->columns;
- }
- static public function set_columns( $columns = null ) {
- self::$theme->columns = $columns;
- }
- static public function setup() {
- self::$query = new stdClass();
-
- global $wp_query;
- $total = 0;
- if ( isset( $wp_query->found_posts ) ) {
- self::$query->total = $wp_query->found_posts;
- }
-
- self::$theme->columns = array(
- array(
- 'label' => __( 'Post Title', 'nighthawk' ),
- 'class' => 'post-title',
- 'callback' => 'nighthawk_td_title',
- ),
- array(
- 'label' => __( 'Comment Count', 'nighthawk' ),
- 'class' => 'comment-count',
- 'callback' => 'nighthawk_td_comment_count',
- ),
- array(
- 'label' => __( 'Comment Link', 'nighthawk' ),
- 'class' => 'comment-respond icon',
- 'callback' => 'nighthawk_td_comment_icon',
- ),
- );
- }
-}
-
function nighthawk_td_edit( $column = array() ) {
echo "\n\t" . '<td class="' . esc_attr( $column['class'] ) . '">';
echo '<a href="' . esc_url( get_edit_post_link() ) . '"><img src="' . esc_url( get_template_directory_uri() . '/images/edit.png' ) . '" alt="' . esc_attr__( 'Edit', 'nighthawk' ) . '"></a>';
@@ -898,13 +837,12 @@ function nighthawk_td_title( $column = array() ) {
}
$title = the_title( '', '', false );
- if ( empty( $title ) ) {
- $title = sprintf( 'untitled %1$s', nighthawk_post_label_singular() );
- }
+ if ( empty( $title ) )
+ $title = sprintf( __( 'Untitled %1$s', 'nighthawk' ), Nighthawk::post_label() );
$url = get_post_meta( get_the_ID(), '_mfields_bookmark_url', true );
if ( ! empty( $url ) ) {
- $title_attr = 'Visit this document';
+ $title_attr = __( 'Visit this document', 'nighthawk' );
$action = get_post_meta( get_the_ID(), '_mfields_bookmark_link_text', true );
if ( ! empty( $action ) ) {
$title_attr = ' title="' . esc_attr( $action ) . '"';
@@ -948,9 +886,8 @@ function nighthawk_td_bookmark_source( $column = array() ) {
$taxonomy = 'mfields_bookmark_source';
$sources = get_the_terms( get_the_ID(), $taxonomy );
- if ( is_wp_error( $sources ) ) {
+ if ( is_wp_error( $sources ) )
return;
- }
$link = '';
if ( ! empty( $sources ) && is_array( $sources ) ) {
View
74 home.php
@@ -15,82 +15,15 @@
* @since Nighthawk 1.0
*/
-if ( ! have_posts() ) {
+if ( ! have_posts() )
get_template_part( '404', 'post' );
-}
get_header( 'post' );
-/*
- * Do we have sticky posts?
- * If so, we will store them in an array.
- */
-$stickies = array();
-while ( have_posts() ) {
- the_post();
- if ( ! is_sticky() ) {
- continue;
- }
- $stickies[] = $post;
-}
-
-/*
- * Display first sticky.
- *
- * The first sticky post will be displayed
- * in the intro div. We will pop it of the
- * sticky array before it is displayed.
- */
-if ( ! empty( $stickies ) ) :
- $post = array_pop( $stickies );
- setup_postdata( $post );
- $image = get_the_post_thumbnail();
-?>
-
- <header id="intro"<?php echo ( ! empty( $image ) ) ? ' class="has-image"' : ''; ?>>
+get_template_part( 'sticky-posts' );
- <?php the_title( '<h1 id="document-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?>
-
- <?php if ( ! empty( $image ) ) : ?>
- <div id="image"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $image; ?></a></div>
- <?php endif; ?>
-
- <div id="summary">
- <?php the_content( __( 'Continue Reading', 'nighthawk' ) ); ?>
- </div>
-
- <?php wp_link_pages( array(
- 'before' => '<div class="page-link contain">',
- 'after' => '</div>'
- ) ); ?>
-
- </header>
-
-<?php endif; ?>
-
-<?php
-/*
- * All other stickies.
- *
- * The remaining stickies, if any, will be
- * displayed in a custom list under the intro.
- */
?>
-<?php if ( ! empty( $stickies ) ) : ?>
- <div id="featured-posts">
- <h2>Featured</h2>
- <ul id="intro-list"><?php
- foreach ( $stickies as $i => $post ) {
- setup_postdata( $post );
- the_title( "\n\t\t" . '<li><a href="' . esc_url( get_permalink() ) . '">', '</a></li>' );
- }
- ?></ul>
- </div>
-<?php endif; ?>
-
-<?php wp_reset_postdata(); ?>
-
<div id="blog" class="contain">
<?php
@@ -98,9 +31,8 @@
the_post();
- if ( is_sticky() ) {
+ if ( is_home() && ! is_paged() && is_sticky() )
continue;
- }
$context = get_post_type();
View
169 inc/post-labels.php
@@ -29,118 +29,74 @@
* @since Nighthawk 1.0
*/
-class Mfields_Post_Label {
- const version = '2.0';
- const context = 'post label';
+class NighthawkPostLabel {
- static public $map = null;
- static public $labels = null;
- static public $textdomain = null;
+ public static $labels = null;
- static public $count = null;
-
- static public function init( $textdomain = null ) {
+ public static function init() {
self::$labels = array(
'page' => array(
- 'standard' => _nx_noop( 'page', 'pages', self::context ),
+ 'standard' => _nx_noop( 'page', 'pages', 'Post Label' ),
),
- 'post_format' => array(
- 'standard' => _nx_noop( 'post', 'posts', self::context ),
- 'aside' => _nx_noop( 'aside', 'asides', self::context ),
- 'audio' => _nx_noop( 'audio file', 'audio files', self::context ),
- 'chat' => _nx_noop( 'chat transcript', 'chat transcripts', self::context ),
- 'gallery' => _nx_noop( 'gallery', 'galleries', self::context ),
- 'image' => _nx_noop( 'image', 'images', self::context ),
- 'link' => _nx_noop( 'link', 'links', self::context ),
- 'quote' => _nx_noop( 'quote', 'quotes', self::context ),
- 'status' => _nx_noop( 'status update', 'status updates', self::context ),
- 'video' => _nx_noop( 'video', 'videos', self::context )
+ 'post' => array(
+ 'standard' => _nx_noop( 'post', 'posts', 'Post Label' ),
+ 'aside' => _nx_noop( 'aside', 'asides', 'Post Label' ),
+ 'audio' => _nx_noop( 'audio file', 'audio files', 'Post Label' ),
+ 'chat' => _nx_noop( 'chat transcript', 'chat transcripts', 'Post Label' ),
+ 'gallery' => _nx_noop( 'gallery', 'galleries', 'Post Label' ),
+ 'image' => _nx_noop( 'image', 'images', 'Post Label' ),
+ 'link' => _nx_noop( 'link', 'links', 'Post Label' ),
+ 'quote' => _nx_noop( 'quote', 'quotes', 'Post Label' ),
+ 'status' => _nx_noop( 'status update', 'status updates', 'Post Label' ),
+ 'video' => _nx_noop( 'video', 'videos', 'Post Label' )
),
'attachment' => array(
- 'standard' => _nx_noop( 'file', 'files', self::context ),
- 'image' => _nx_noop( 'image', 'images', self::context ),
- 'icon' => _nx_noop( 'icon', 'icons', self::context ),
- 'zip' => _nx_noop( 'zip archive', 'zip archives', self::context ),
- 'doc' => _nx_noop( 'document', 'documents', self::context ),
- 'pdf' => _nx_noop( 'PDF', 'PDFs', self::context ),
- 'spreadsheet' => _nx_noop( 'spreadsheet', 'spreadsheets', self::context ),
- 'video' => _nx_noop( 'video', 'videos', self::context ),
+ 'standard' => _nx_noop( 'file', 'files', 'Post Label' ),
+ 'image' => _nx_noop( 'image', 'images', 'Post Label' ),
+ 'icon' => _nx_noop( 'icon', 'icons', 'Post Label' ),
+ 'zip' => _nx_noop( 'zip archive', 'zip archives', 'Post Label' ),
+ 'doc' => _nx_noop( 'document', 'documents', 'Post Label' ),
+ 'pdf' => _nx_noop( 'PDF', 'PDFs', 'Post Label' ),
+ 'spreadsheet' => _nx_noop( 'spreadsheet', 'spreadsheets', 'Post Label' ),
+ 'video' => _nx_noop( 'video', 'videos', 'Post Label' ),
),
);
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' );
if ( ! empty( $post_types ) && is_array( $post_types ) ) {
- self::$labels['custom'] = array();
foreach ( (array) $post_types as $name => $post_type ) {
- self::$labels['custom'][$name] = array(
+ self::$labels[$post_type]['standard'] = array(
0 => $post_type->labels->singular_name,
1 => $post_type->labels->name,
- 2 => self::context,
+ 2 => 'Post Label',
'singular' => $post_type->labels->singular_name,
'plural' => $post_type->labels->name,
- 'context' => self::context,
+ 'context' => 'Post Label',
);
}
}
}
- static public function get_label() {
- self::$count++;
+ public static function get( $type = 'singular' ) {
+ $count = ( 'singular' == $type ) ? 1 : 2;
+ return translate_nooped_plural( self::get_noop(), $count, 'nighthawk' );
+ }
- $key = get_the_ID();
- if ( is_tax( 'post_format' ) ) {
- global $wp_query;
- $term = get_term( $wp_query->get_queried_object(), 'post_format' );
- if ( isset( $term->slug ) ) {
- $key = str_replace( 'post-format-', '', $term->slug );
- }
- }
+ private static function get_noop() {
+ $key = 'standard';
- if ( isset( self::$map[$key] ) ) {
- return self::$map[$key];
- }
+ $post_format = get_post_format();
+ if ( ! empty( $post_format ) )
+ $key = $post_format;
$post_type = get_post_type();
+ if ( isset( self::$labels[$post_type][$key] ) )
+ return self::$labels[$post_type][$key];
- switch ( get_post_type() ) {
- case 'post' :
- $output = self::post();
- break;
- case 'page' :
- $output = array(
- 'context' => 'page',
- 'type' => 'standard',
- );
- break;
- case 'attachment' :
- $output = self::attachment();
- break;
- default :
- $output = array(
- 'context' => 'custom',
- 'type' => $post_type,
- );
- break;
- }
-
- $output = self::find( $output );
-
- self::$map[$key] = $output;
- return $output;
+ return _nx_noop( 'entry', 'entries', 'post label' );
}
- static public function post() {
- $type = get_post_format();
- if ( empty( $type ) ) {
- $type = 'standard';
- }
- return array(
- 'context' => 'post_format',
- 'type' => $type,
- );
- }
-
- static public function attachment() {
+ private static function get_attachment_key() {
$mime = get_post_mime_type();
switch ( $mime ) {
case 'image/jpeg' :
@@ -157,62 +113,33 @@ static public function attachment() {
case 'video/mp4' :
case 'video/ogg' :
case 'video/x-matroska' :
- $parts = explode( '/', $mime );
- $type = $parts[0];
+ $key = 'video';
break;
case 'image/x-icon' :
- $type = 'icon';
+ $key = 'icon';
break;
case 'application/pdf' :
- $type = 'pdf';
+ $key = 'pdf';
break;
case 'application/zip' :
- $type = 'zip';
+ $key = 'zip';
break;
case 'image/x-icon' :
- $type = 'icon';
+ $key = 'icon';
break;
case 'application/vnd.ms-excel' :
case 'application/vnd.oasis.opendocument.spreadsheet' :
- $type = 'doc';
+ $key = 'doc';
break;
case 'application/msword' :
case 'application/vnd.oasis.opendocument.text' :
- $type = 'doc';
+ $key = 'doc';
break;
default :
- $type = 'default';
+ $key = 'standard';
break;
}
- return array(
- 'context' => 'attachment',
- 'type' => $type,
- );
- }
-
- static public function find( $v ) {
- $v = wp_parse_args( $v, array(
- 'context' => null,
- 'type' => null,
- ) );
-
- extract( (array) $v );
-
- if ( isset( self::$labels[$context][$type] ) ) {
- return self::$labels[$context][$type];
- }
- else {
- return _nx_noop( 'entry', 'entries', 'post label' );
- }
- }
-
- static public function dump() {
- echo '<pre>';
- echo __class__ . ' v' . self::version . "\n";
- echo "\n" . 'Times used: ' . self::$count;
- echo "\n" . '$map: ' . print_r( self::$map, true );
- echo "\n" . '$labels: ' . print_r( self::$labels, true );
- echo '</pre>';
+ return $type;
}
}
View
4 loop-search.php
@@ -20,8 +20,6 @@
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <?php do_action( 'nighthawk_entry_start' ); ?>
-
<?php the_title( "\t" . '<h2 class="entry-title heading">', '</h2>' ); ?>
<p class="content">
@@ -33,7 +31,7 @@
<span class="post-excerpt"><?php the_excerpt(); ?></span>
<a class="permalink" href="<?php echo esc_url( get_permalink() ); ?>"><?php
- printf( esc_html__( 'View this %1$s', 'nighthawk' ), nighthawk_post_label_singular() );
+ printf( esc_html__( 'View this %1$s', 'nighthawk' ), Nighthawk::post_label() );
?></a>
</p>
View
2  loop-table.php
@@ -18,7 +18,7 @@
*/
if ( have_posts() ) {
- $columns = Nighthawk::columns();
+ $columns = Nighthawk::get_table_columns();
echo "\n\n" . '<table class="post-archive">' . "\n";
View
2  searchform.php
@@ -9,7 +9,7 @@
* @since Nighthawk 1.0
*/
-$id_attr = nighthawk_search_id();
+$id_attr = Nighthawk::searchform_id();
?>
<form class="bullet" role="search" method="get" action="<?php echo get_option( 'siteurl' ); ?>">
View
71 sticky-posts.php
@@ -0,0 +1,71 @@
+<?php
+if ( ! is_home() || is_paged() )
+ return;
+
+/*
+ * Do we have sticky posts?
+ * If so, we will store them in an array.
+ */
+$stickies = array();
+while ( have_posts() ) {
+ the_post();
+ if ( is_sticky() )
+ $stickies[] = $post;
+}
+
+/*
+ * Display first sticky.
+ *
+ * The first sticky post will be displayed
+ * in the intro div. We will pop it of the
+ * sticky array before it is displayed.
+ */
+if ( ! empty( $stickies ) ) :
+ $post = array_pop( $stickies );
+ setup_postdata( $post );
+ $image = get_the_post_thumbnail();
+?>
+
+ <header id="intro"<?php echo ( ! empty( $image ) ) ? ' class="has-image"' : ''; ?>>
+
+ <?php the_title( '<h1 id="document-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?>
+
+ <?php if ( ! empty( $image ) ) : ?>
+ <div id="image"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $image; ?></a></div>
+ <?php endif; ?>
+
+ <div id="summary">
+ <?php the_content( __( 'Continue Reading', 'nighthawk' ) ); ?>
+ </div>
+
+ <?php wp_link_pages( array(
+ 'before' => '<div class="page-link contain">',
+ 'after' => '</div>'
+ ) ); ?>
+
+ </header>
+
+<?php endif; ?>
+
+<?php
+/*
+ * All other stickies.
+ *
+ * Any remaining stickies will be displayed
+ * in a custom list under the intro.
+ */
+?>
+
+<?php if ( ! empty( $stickies ) ) : ?>
+ <div id="featured-posts">
+ <h2>Featured</h2>
+ <ul id="intro-list"><?php
+ foreach ( $stickies as $i => $post ) {
+ setup_postdata( $post );
+ the_title( "\n\t\t" . '<li><a href="' . esc_url( get_permalink() ) . '">', '</a></li>' );
+ }
+ ?></ul>
+ </div>
+<?php endif; ?>
+
+<?php wp_reset_postdata(); ?>
View
133 style.css
@@ -193,6 +193,10 @@ var {
/* =Block Level Elements
-------------------------------------------------------------- */
+article,
+aside {
+ display: block;
+}
address,
article,
aside,
@@ -207,7 +211,7 @@ table,
ul,
.embed,
.entry-content div {
- display: block;
+
font-size: 1em;
line-height: 1.5em;
margin: 1.5em 0;
@@ -287,8 +291,9 @@ blockquote blockquote:last-child {
-------------------------------------------------------------- */
table {
- border-collapse: collapse;
border: .1em solid #555;
+ border-collapse: collapse;
+ width: 100%;
}
th,
td {
@@ -486,7 +491,7 @@ ul.form-errors li.form-error-message {
#wrap {
margin: 0 auto;
- max-width: 56em;
+ max-width: 66em;
padding: 0 1em 1em;
}
#header {
@@ -528,7 +533,7 @@ ul.form-errors li.form-error-message {
z-index: 1;
}
#content {
- padding: 1.5em 3em;
+ padding: 1.5em 6em;
overflow: hidden;
}
@@ -565,7 +570,7 @@ ul.form-errors li.form-error-message {
#menu-bottom {
clear: both;
margin: 1em auto 2em;
- max-width: 56em;
+ max-width: 66em;
}
#menu-bottom.no-menu {
max-width: 50em;
@@ -974,16 +979,79 @@ ul.form-errors li.form-error-message {
}
-/* =Widgets
+/* =All Widgets
+-------------------------------------------------------------- */
+
+.widget {
+ overflow: hidden;
+}
+.widget img {
+ max-width: 100%;
+ height: auto;
+}
+.widget .wp-caption {
+ padding: 0;
+ text-align:center;
+ width: 100%;
+}
+.widget .wp-caption-text {
+ margin:0;
+}
+.widget-title,
+.widget ol,
+.widget ul,
+.widget p:first-child,
+.widget ul:first-child {
+ margin-top: 0;
+}
+.widget select {
+ min-width: 100%
+}
+
+
+/* =Individual Widgets
+-------------------------------------------------------------- */
+
+.widget_rss ul {
+ padding:0;
+ list-style-type: none;
+}
+.widget_rss li {
+ margin-bottom: 1.5em;
+}
+.widget_rss li .rsswidget {
+ display: block;
+ font-size: 1.1em;
+}
+.rss-date,
+.widget_rss cite {
+ color: #999;
+ display: block;
+ font-style: italic;
+ line-height: 2em;
+}
+
+.widget_calendar {
+ border-color: #ccc;
+}
+.widget_calendar td {
+ padding: 1.5% 0;
+ text-align: center;
+ width: 14.28%;
+ font-weight: bold;
+ border-color: #ccc;
+}
+
+
+/* =Footer Widgets
-------------------------------------------------------------- */
-#widgets {
+.footer-widgets {
clear: both;
position: relative;
z-index: 0;
background-color: #fff;
margin: 0 1em;
- padding: 1em;
color: #666;
-webkit-border-bottom-left-radius: .5em;
-webkit-border-bottom-right-radius: .5em;
@@ -995,49 +1063,33 @@ ul.form-errors li.form-error-message {
-moz-box-shadow: 0 0 .75em rgba( 0, 0, 0, 0.4 );
box-shadow: 0 0 .75em rgba( 0, 0, 0, 0.4 );
}
-#widgets .area {
+.footer-widgets .area {
float: left;
+ margin: 3.125%;
+ width: 93.75%;
+}
+.footer-widgets-count-2 .area-1 {
+ width: 60.25%;
}
-#widgets.count-1 .area-1 { width: 100%; }
-#widgets.count-2 .area-1 { width: 30em; }
-#widgets.count-2 .area-2 { width: 15em; margin:0 0 0 1.5em; }
-#widgets.count-3 .area { width: 14em; }
-#widgets.count-3 .area-1 { margin: 0; }
-#widgets.count-3 .area-2 { margin: 0 2em; }
-#widgets.count-3 .area-3 { margin: 0; }
-#widgets .area,
-#widgets .area p,
-#widgets .area li {
+.footer-widgets-count-2 .area-2,
+.footer-widgets-count-3 .area {
+ width: 27%;
+}
+.footer-widgets .area,
+.footer-widgets .area p,
+.footer-widgets .area li {
line-height: 1.4;
}
-#widgets h3.widget-title {
+.footer-widgets h3.widget-title {
margin-bottom: .25em;
font-size: 1.1em;
}
-#widgets .widget-container {
+.footer-widgets .widget-container {
margin-bottom: 1.5em;
}
-#widgets .widget-container ul {
+.footer-widgets .widget-container ul {
list-style-type: square;
}
-#widgets .widget-title,
-#widgets .widget-container ol,
-#widgets .widget-container ul,
-#widgets .widget-container p:first-child,
-#widgets .widget-container ul:first-child,
-#widgets .textwidget p:first-child {
- margin-top: 0;
-}
-#wp-calendar {
- border-color: #ccc;
-}
-#wp-calendar td {
- padding: 1.5% 0;
- text-align: center;
- width: 14.28%;
- font-weight: bold;
- border-color: #ccc;
-}
/* =Buttons
@@ -1133,6 +1185,7 @@ div.aligncenter {
clip: rect(1px, 1px, 1px, 1px);
}
+
/* =Smaller Text, Lighter Color
-------------------------------------------------------------- */
View
8 taxonomy-mfields_bookmark_source.php
@@ -33,12 +33,12 @@
$sentence = sprintf( _n( 'This site contains one %2$s from %4$s.', 'This site contains %1$s %3$s from %4$s.', Nighthawk::post_total(), 'nighthawk' ),
number_format_i18n( Nighthawk::post_total() ),
- '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . nighthawk_post_label_singular() . '</a>',
- '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . nighthawk_post_label_plural() . '</a>',
+ '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . Nighthawk::post_label() . '</a>',
+ '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . Nighthawk::post_label( 'plural' ) . '</a>',
single_term_title( '', false )
);
- $feed_title = sprintf( esc_attr__( 'Get updated when a new %1$s by %2$s is published.', 'nighthawk' ), nighthawk_post_label_singular(), single_term_title( '', false ) );
+ $feed_title = sprintf( esc_attr__( 'Get updated when a new %1$s by %2$s is published.', 'nighthawk' ), Nighthawk::post_label(), single_term_title( '', false ) );
$feed_url = get_term_feed_link( get_queried_object_id(), get_query_var( 'taxonomy' ) );
@@ -53,7 +53,7 @@
<div id="content" class="contain">
<?php
- Nighthawk::set_columns( array(
+ Nighthawk::set_table_columns( array(
array(
'label' => __( 'Post Title', 'nighthawk' ),
'class' => 'post-title',
View
8 taxonomy-mfields_bookmark_type.php
@@ -33,12 +33,12 @@
$sentence = sprintf( _n( 'This site contains one %2$s labeled as %4$s.', 'This site contains %1$s %3$s labeled as %4$s.', Nighthawk::post_total(), 'nighthawk' ),
number_format_i18n( Nighthawk::post_total() ),
- '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . nighthawk_post_label_singular() . '</a>',
- '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . nighthawk_post_label_plural() . '</a>',
+ '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . Nighthawk::post_label() . '</a>',
+ '<a href="' . esc_url( get_post_type_archive_link( 'mfields_bookmark' ) ) . '">' . Nighthawk::post_label( 'plural' ) . '</a>',
single_term_title( '', false )
);
- $feed_title = sprintf( esc_attr__( 'Get updated when a new %1$s by %2$s is published.', 'nighthawk' ), nighthawk_post_label_singular(), single_term_title( '', false ) );
+ $feed_title = sprintf( esc_attr__( 'Get updated when a new %1$s by %2$s is published.', 'nighthawk' ), Nighthawk::post_label(), single_term_title( '', false ) );
$feed_url = get_term_feed_link( get_queried_object_id(), get_query_var( 'taxonomy' ) );
@@ -53,7 +53,7 @@
<div id="content" class="contain">
<?php
- Nighthawk::set_columns( array(
+ Nighthawk::set_table_columns( array(
array(
'label' => __( 'Post Title', 'nighthawk' ),
'class' => 'post-title',

No commit comments for this range

Something went wrong with that request. Please try again.