max_num_pages; } // Don't print empty markup if there's only one page. if ( $max_num_pages < 2 ) { return; } ?> %2$s'; $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 = sprintf( /* translators: %s: date */ esc_html_x( 'Posted on %s', 'post date', 'timber-lite' ), '' . $time_string . '' ); echo '' . $posted_on . ''; // phpcs:ignore } endif; if ( ! function_exists( 'timber_lite_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function timber_lite_entry_footer() { // Hide category and tag text for pages. if ( 'post' == get_post_type() ) { echo '
'; $tags_list = get_the_tag_list(); if ( $tags_list ) { /* translators: %s: tag list */ printf( ' ', $tags_list ); // phpcs:ignore } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; /* translators: %s: Number of comments */ comments_popup_link( esc_html__( 'Leave a comment', 'timber-lite' ), esc_html__( '1 Comment', 'timber-lite' ), esc_html__( '% Comments', 'timber-lite' ) ); echo ''; } edit_post_link( esc_html__( 'Edit', 'timber-lite' ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function timber_lite_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'timber_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( 'timber_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so timber_lite_categorized_blog should return true. return true; } else { // This blog has only 1 category so timber_lite_categorized_blog should return false. return false; } } /** * Flush out the transients used in timber_lite_categorized_blog. */ function timber_lite_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'timber_categories' ); } add_action( 'edit_category', 'timber_lite_category_transient_flusher' ); add_action( 'save_post', 'timber_lite_category_transient_flusher' ); if ( ! function_exists( 'timber_lite_get_custom_excerpt' ) ) : /** * Generate a custom post excerpt suited to both latin alphabet languages and multibyte ones, like Chinese of Japanese * * @param int|WP_Post $id Optional. Post ID or post object. * @return string The custom excerpt */ function timber_lite_get_custom_excerpt( $post_id = null ) { $post = get_post( $post_id ); if ( empty( $post ) ) { return ''; } //so we need to generate a custom excerpt // //the problem arises when we are dealing with multibyte characters //in this case we need to do a multibyte character length excerpt not the regular, number of words excerpt //but first we need to detect such a case //the excerpt returned by WordPress $excerpt = get_the_excerpt(); //now we try to truncate the default excerpt with the length = number of words * 6 - the average word length in English $mb_excerpt = timber_lite_truncate( $excerpt, ( apply_filters( 'excerpt_length', 55 ) * 6 ) ); //if the multibyte excerpt's length is smaller then the regular excerpt's length divided by 1.8 (this is a conservative number) //then it's quite clear that the default one is no good //else leave things like they used to work if ( mb_strlen( $mb_excerpt ) < mb_strlen( $excerpt ) / 1.8 ) { $excerpt = $mb_excerpt; } return $excerpt; } endif; if ( ! function_exists( 'timber_lite_post_excerpt' ) ) : /** * Display the post excerpt, either with the tag or regular excerpt * * @param int|WP_Post $id Optional. Post ID or post object. */ function timber_lite_post_excerpt( $post_id = null ) { $post = get_post( $post_id ); if ( empty( $post ) ) { return; } // Check the content for the more text $has_more = strpos( $post->post_content, '' . PHP_EOL; } } } //SECOND, split by iframes and embeds that were not wrapped by Jetpack //this will use recursion to process content between the videos $tags = implode( '|', array( 'video', 'audio', 'iframe', 'embed' ) ); $num_matches = preg_match_all( '#<(?P