%2$s'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $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() ) ); $posted_on = '' . $time_string . ''; $byline = sprintf( '' . esc_html_x( 'by %s', 'post author', 'oceanica-lite' ), ' ' ); $string = '' . $posted_on . ' '; // WPCS: XSS OK. return $string; } endif; if ( ! function_exists( 'oceanica_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time, author, categories. */ function oceanica_posted_on() { global $post; $flag = false; $posted_on_by = apply_filters( 'oceanica_get_posted_on_by', oceanica_get_posted_on_by() ); if ( $posted_on_by != '' ) { echo $posted_on_by; $flag = true; } if ( ! is_singular() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { if ( $flag ) { echo ' '; } echo ''; comments_popup_link( sprintf( __( 'Leave a comment on %s', 'oceanica-lite' ), get_the_title() ) ); echo ''; $flag = true; } if ( $flag ) { echo ' '; } /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( ', ' ); if ( $categories_list && oceanica_categorized_blog() ) { printf( '' . esc_html__( ' in ', 'oceanica-lite' ) . ' %1$s', $categories_list ); // WPCS: XSS OK. } } endif; if ( ! function_exists( 'oceanica_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function oceanica_entry_footer() { // Hide category and tag text for pages. if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; /* translators: %s: post title */ comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment on %s', 'oceanica-lite' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) ); echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'oceanica-lite' ), the_title( '"', '"', false ) ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function oceanica_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'oceanica_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 = count( $all_the_cool_cats ); set_transient( 'oceanica_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so oceanica_categorized_blog should return true. return true; } else { // This blog has only 1 category so oceanica_categorized_blog should return false. return false; } } /** * Flush out the transients used in oceanica_categorized_blog. */ function oceanica_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'oceanica_categories' ); } add_action( 'edit_category', 'oceanica_category_transient_flusher' ); add_action( 'save_post', 'oceanica_category_transient_flusher' ); if ( ! function_exists( 'oceanica_post_thumbnail' ) ) : /** * Displays an optional post thumbnail. * * Wraps the post thumbnail in an anchor element on index views, or a div * element when on single views. */ function oceanica_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : global $post; $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'oceanica-thumb-large' ); ?>
' . $more_link . '
'; } endif; if ( ! function_exists( 'oceanica_child_pages' ) ) : /** * Displays the page child pages. */ function oceanica_child_pages() { global $post; $args = apply_filters( 'oceanica_child_pages_args', array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'ignore_sticky_posts' => 1, 'meta_query' => array( array( 'key' => '_thumbnail_id' ) ) ) ); $parent = new WP_Query( $args ); if ( $parent->have_posts() ) :?>