post_content; if ( ! empty( $post_obj->post_excerpt ) ) { $source_content = $post_obj->post_excerpt; } $source_content = preg_replace( '`\[[^\]]*\]`', '', $source_content ); $trimmed_content = wp_trim_words( $source_content, $length, '...' ); return apply_filters( 'business_center_trim_content', $trimmed_content ); } endif; if ( ! function_exists( 'business_center_excerpt_more' ) && ! is_admin() ) : /** * Replaces "[...]" (appended to automatically generated excerpts) with ... and * a 'Continue reading' link. * * Create your own business_center_excerpt_more() function to override in a child theme. * * @since Business Center 0.1 * * @return string 'Continue reading' link prepended with an ellipsis. */ function business_center_excerpt_more() { $link = sprintf( '%2$s', esc_url( get_permalink( get_the_ID() ) ), /* translators: %s: Name of current post */ sprintf( __( ' "%s"', 'business-center' ), get_the_title( get_the_ID() ) ) ); return $link; } add_filter( 'excerpt_more', 'business_center_excerpt_more' ); endif; if ( ! function_exists( 'business_center_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. * * Create your own business_center_post_thumbnail() function to override in a child theme. * * @since Business Center 0.1 */ function business_center_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } ?> ' %title', 'next_text' => '%title ' ) ); } endif; if ( ! function_exists( 'business_center_archive_post_navigation' ) ) : /** * Displays an optional archive navigation * * * Create your own business_center_archive_post_navigation() function to override in a child theme. * * @since Business Center 0.1 */ function business_center_archive_post_navigation() { $options = business_center_get_theme_options(); if ( ! $options['enable_pagination'] ) return; ?>
'list' ) ); } else { return the_posts_navigation( array( 'prev_text' => ''.__( 'Older Posts', 'business-center' ), 'next_text' => __( 'Newer Posts', 'business-center' ) . '' ) ); } ?>
%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 = ''.__( 'Posted By', 'business-center' ).'' . esc_html( get_the_author() ) . ''; echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK. } endif; if ( ! function_exists( 'business_center_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function business_center_entry_footer() { // Hide category and tag text for pages. if ( 'post' === get_post_type() ) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', 'business-center' ) ); if ( $categories_list && business_center_categorized_blog() ) { echo '' . $categories_list . ''; // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'business-center' ) ); if ( $tags_list ) { echo '' . $tags_list . ''; // WPCS: XSS OK. } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( get_comments_number(), esc_html__( 'One', 'business-center' ) ); echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'business-center' ), the_title( '"', '"', false ) ), '', '' ); } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function business_center_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'business_center_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( 'business_center_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so business_center_categorized_blog should return true. return true; } else { // This blog has only 1 category so business_center_categorized_blog should return false. return false; } } /** * Flush out the transients used in business_center_categorized_blog. */ function business_center_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'business_center_categories' ); } add_action( 'edit_category', 'business_center_category_transient_flusher' ); add_action( 'save_post', 'business_center_category_transient_flusher' );