max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) return; ?> post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) return; ?> comment_type || 'trackback' == $comment->comment_type ) : ?>
  • >
    ', '' ); ?>
  • >
    says:', 'bushwick' ), sprintf( '%s', get_comment_author_link() ) ); ?>
    comment_approved ) : ?>

    'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    post_parent ) { /** * Grab the IDs of all the image attachments in a gallery so we can get the URL * of the next adjacent image in a gallery, or the first image (if we're * looking at the last image in a gallery), or, in a gallery of one, just the * link to that image file. */ $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); // If there is more than 1 attachment in a gallery... if ( count( $attachments ) > 1 ) { foreach ( $attachments as $k => $attachment ) { if ( $attachment->ID == $post->ID ) break; } $k++; // get the URL of the next image attachment... if ( isset( $attachments[ $k ] ) ) { $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); } // or get the URL of the first image attachment. else { $next_attachment_url = get_attachment_link( $attachments[0]->ID ); } } } printf( '%3$s', esc_url( $next_attachment_url ), the_title_attribute( array( 'echo' => false ) ), wp_get_attachment_image( $post->ID, $attachment_size ) ); } endif; if ( ! function_exists( 'bushwick_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function bushwick_posted_on() { printf( __( 'Posted ago by .', 'bushwick' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), bushwick_time_diff( get_the_time( 'U' ) ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'bushwick' ), get_the_author() ) ), get_the_author() ); } endif; if ( ! function_exists( 'bushwick_time_diff' ) ) : /** * Determines the difference between two timestamps. * * The difference is returned in a human readable format such as "1 hour", * "5 mins", "2 days". * * @param int $from Unix timestamp from which the difference begins. * @param int $to Optional. Unix timestamp to end the time difference. Default becomes current time if not set. * @return string Human readable time difference. */ function bushwick_time_diff( $from, $to = '' ) { $since = null; $month_in_seconds = 30 * DAY_IN_SECONDS; if ( empty( $to ) ) $to = current_time( 'timestamp' ); $diff = (int) abs( $to - $from ); if ( $diff <= HOUR_IN_SECONDS ) { $mins = round( $diff / MINUTE_IN_SECONDS ); if ( $mins <= 1 ) { $mins = 1; } /* translators: min=minute */ $since = sprintf( _n( '%s min', '%s mins', $mins, 'bushwick' ), $mins ); } elseif ( ( $diff <= DAY_IN_SECONDS ) && ( $diff > HOUR_IN_SECONDS ) ) { $hours = round( $diff / HOUR_IN_SECONDS ); if ( $hours <= 1 ) { $hours = 1; } $since = sprintf( _n( '%s hour', '%s hours', $hours, 'bushwick' ), $hours ); } elseif ( ( $diff <= WEEK_IN_SECONDS ) && ( $diff > DAY_IN_SECONDS ) ) { $days = round( $diff / DAY_IN_SECONDS ); if ( $days <= 1 ) { $days = 1; } $since = sprintf( _n( '%s day', '%s days', $days, 'bushwick' ), $days ); } elseif ( ( $diff <= $month_in_seconds ) && ( $diff > WEEK_IN_SECONDS ) ) { $weeks = round( $diff / WEEK_IN_SECONDS ); if ( $weeks <= 1 ) { $weeks = 1; } $since = sprintf( _n( '%s week', '%s weeks', $weeks, 'bushwick' ), $weeks ); } elseif ( ( $diff <= YEAR_IN_SECONDS ) && ( $diff > $month_in_seconds ) ) { $months = round( $diff / $month_in_seconds ); if ( $months <= 1 ) { $months = 1; } $since = sprintf( _n( '%s month', '%s months', $months, 'bushwick' ), $months ); } elseif ( $diff >= YEAR_IN_SECONDS ) { $years = round( $diff / YEAR_IN_SECONDS ); if ( $years <= 1 ) { $years = 1; } $since = sprintf( _n( '%s year', '%s years', $years, 'bushwick' ), $years ); } return $since; } endif; /** * Returns true if a blog has more than 1 category */ function bushwick_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 = is_countable( $all_the_cool_cats ) ? count( $all_the_cool_cats ) : 0; set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so bushwick_categorized_blog should return true return true; } else { // This blog has only 1 category so bushwick_categorized_blog should return false return false; } } /** * Flush out the transients used in bushwick_categorized_blog */ function bushwick_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } add_action( 'edit_category', 'bushwick_category_transient_flusher' ); add_action( 'save_post', 'bushwick_category_transient_flusher' );