max_num_pages; } // Don't print empty markup if there's only one page. if ( $max_num_pages < 2 ) { return; } ?> %2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = ''; } // Format time string $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); // Output variable $entry_meta_output = ''; // Author $author = '' . esc_html( get_the_author() ) . ''; // Post date $post_date = '' . $time_string . ''; // Categories $categories_list = get_the_term_list( get_the_ID(), 'category', '', esc_html_x( ', ', 'Categories separator', 'rebalance' ), '' ); // Project type $project_type_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', esc_html_x( ', ', 'Categories separator', 'rebalance' ), '' ); // Portfolio output if ( 'jetpack-portfolio' === get_post_type() ) { $entry_meta_output .= $project_type_list; echo $entry_meta_output; // WPCS: XSS OK. // Everything else's output } else { $entry_meta_output .= $author; $entry_meta_output .= $post_date; $entry_meta_output .= $categories_list; echo $entry_meta_output; // WPCS: XSS OK. } // Edit link edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'rebalance' ), the_title( '"', '"', false ) ), '', '' ); } endif; if ( ! function_exists( 'rebalance_entry_footer' ) ) : /** * Prints HTML with meta information for the tags, project-tags and edit links. */ function rebalance_entry_footer() { // Posts if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'rebalance' ) ); if ( $tags_list && ! is_wp_error( $tags_list ) ) { echo '' . $tags_list . ''; } } // Projects if ( is_single() && 'jetpack-portfolio' === get_post_type() ) { // Show project TAGS on single project templates $project_tags_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-tag', '', esc_html__( ', ', 'rebalance' ), '' ); if ( $project_tags_list ) { echo $project_tags_list; } } elseif ( 'jetpack-portfolio' === get_post_type() ) { // Show project TYPES on all other project templates $project_type_list = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', esc_html__( ', ', 'rebalance' ), '' ); if ( $project_type_list ) { echo $project_type_list; } } // Edit link edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'rebalance' ), the_title( '"', '"', false ) ), '', '' ); } endif; if ( ! function_exists( 'rebalance_author_meta' ) ) : /** * Prints HTML with meta information for the tags, project-tags and edit links. */ function rebalance_author_meta() { // If a user has filled out their description, show a bio on their entries if ( get_the_author_meta( 'description' ) ) { ?>

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. */ $attachment_ids = get_posts(array( 'post_parent' => $post->post_parent, 'fields' => 'ids', 'numberposts' => 999, '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 (is_countable($attachment_ids) && count($attachment_ids) > 1) { foreach ($attachment_ids as $idx => $attachment_id) { if ($attachment_id == $post->ID) { $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ]; break; } } // get the URL of the next image attachment... if ($next_id) { $next_attachment_url = get_attachment_link($next_id); } // or get the URL of the first image attachment. else { $next_attachment_url = get_attachment_link(reset($attachment_ids)); } } } printf('%2$s', esc_url($next_attachment_url), wp_get_attachment_image($post->ID, $attachment_size) ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function rebalance_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'rebalance_categories' ) ) ) { // Create an array of all the categories that are attached to posts. $all_the_cool_cats = get_categories( array( 'fields' => 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, ) ); // 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( 'rebalance_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so rebalance_categorized_blog should return true. return true; } else { // This blog has only 1 category so rebalance_categorized_blog should return false. return false; } } /** * Flush out the transients used in rebalance_categorized_blog. */ function rebalance_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'rebalance_categories' ); } add_action( 'edit_category', 'rebalance_category_transient_flusher' ); add_action( 'save_post', 'rebalance_category_transient_flusher' ); /** * Jetpack Portfolio template checker * * Checks if various Jetpack portfolio archives are bring loaded * * @return boolean true/false * @since 1.0 */ function rebalance_is_jetpack_portfolio_archive() { if ( is_post_type_archive( 'jetpack-portfolio' ) || is_tax( 'jetpack-portfolio-type' ) || is_tax( 'jetpack-portfolio-tag' ) ) { return true; } }