%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( /* translators: %s: post author */ '' . esc_html_x( 'by %s', 'post author', 'oceanica-lite' ), '' . esc_html( get_the_author() ) . '' ); $string = '' . $posted_on . '' . $byline . ''; // 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() { $posted_on_by = apply_filters( 'oceanica_get_posted_on_by', oceanica_get_posted_on_by() ); if ( is_sticky() ) : ?>
'; /* 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 ''; } /* 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( ' %2$s' . esc_html__( ' in ', 'oceanica-lite' ) . ' %1$s', $categories_list, ''); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } 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' ); ?>
' ' . '' . esc_html__( 'Next post:', 'oceanica-lite' ) . ' ' . '%title', 'prev_text' => ' ' . '' . esc_html__( 'Previous post:', 'oceanica-lite' ) . ' ' . '%title' ) ); } endif; if ( ! function_exists( 'oceanica_the_posts_pagination' ) ) : /** * Displays the post pagination. */ function oceanica_the_posts_pagination() { the_posts_pagination( array( 'prev_text' => '', 'next_text' => '', 'before_page_number' => '' . esc_html__( 'Page', 'oceanica-lite' ) . ' ', 'mid_size' => 2, ) ); } endif; if ( ! function_exists( 'oceanica_excerpt' ) ) : /** * Displays the optional excerpt. * * Wraps the excerpt in a div element. * * Create your own oceanica_excerpt() function to override in a child theme. * * @param string $class Optional. Class string of the div element. Defaults to 'entry-summary'. */ function oceanica_excerpt( $class = 'entry-summary' ) { if ( has_excerpt() || is_search() ) : $excerpt = get_the_excerpt(); if ( ! empty( $excerpt ) ) { ?>
%1$s %2$s %3$s

', esc_html__( 'Tagged: ', 'oceanica-lite' ), esc_html_x( 'Tags', 'Used before tag names.', 'oceanica-lite' ), $tags_list // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } } } endif; if ( ! function_exists( 'oceanica_excerpt_more' ) && ! is_admin() ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and * a 'Continue reading' link. * * Create your own oceanica_excerpt_more() function to override in a child theme. * * * @return string 'Continue reading' link prepended with an ellipsis. */ function oceanica_excerpt_more() { $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( wp_kses(__( 'Continue reading "%s"', 'oceanica-lite' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title( get_the_ID() ) ) ); return ' … ' . $link; } add_filter( 'excerpt_more', 'oceanica_excerpt_more' ); endif; if ( ! function_exists( 'oceanica_read_more' ) ) : /** * Create your own oceanica_read_more() function to override in a child theme. */ function oceanica_read_more( $more_link, $more_link_text ) { return '

' . $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, // phpcs:ignore WPThemeReview.CoreFunctionality.PostsPerPage.posts_per_page_posts_per_page '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() ) :?>
have_posts() ) : $parent->the_post(); ?>
'page', 'posts_per_page' => -1, // phpcs:ignore WPThemeReview.CoreFunctionality.PostsPerPage.posts_per_page_posts_per_page 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order' ) ); $parent = new WP_Query( $args ); if ( $parent->have_posts() ) :?>
have_posts() ) : $parent->the_post(); ?>
'post', 'posts_per_page' => 3, 'ignore_sticky_posts' => 1, 'meta_query' => array( array( 'key' => '_thumbnail_id' ) ) ) ); $parent = new WP_Query( $args ); $i = 0; if ( $parent->have_posts() ) :?>
have_posts() ) : $parent->the_post(); $i ++; if ( $i == 2 ) { ?>
ID ); if ( $tags ) { $tag_ids = array(); foreach ( $tags as $individual_tag ) { $tag_ids[] = $individual_tag->term_id; } $args = array( 'tag__in' => $tag_ids, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 4 ); $my_query = new wp_query( $args ); if ( $my_query->have_posts() ): ?>