' . get_the_title() . '' ); $more = sprintf( '%s', get_permalink(), $text ); return $excerpt . $more; } //add_filter( 'the_excerpt', 'trifold_the_excerpt' ); if ( ! function_exists( 'trifold_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function trifold_posted_on() { $time_string = ''; 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 = sprintf( esc_html_x( 'Posted on %s', 'post date', 'trifold' ), '' . $time_string . '' ); $byline = sprintf( esc_html_x( 'by %s', 'post author', 'trifold' ), '' . esc_html( get_the_author() ) . '' ); echo '' . $posted_on . ' ' . $byline . ''; // WPCS: XSS OK. } endif; if ( ! function_exists( 'trifold_entry_footer' ) ) : /** * Prints HTML with meta information for the categories, tags and comments. */ function trifold_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__( '/', 'trifold' ) ); if ( $categories_list && trifold_categorized_blog() ) { printf( '' . esc_html__( 'in %1$s', 'trifold' ) . '', $categories_list ); // WPCS: XSS OK. } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; comments_popup_link( esc_html__( '0 Comments', 'trifold' ), esc_html__( '1 Comment', 'trifold' ), esc_html__( '% Comments', 'trifold' ) ); echo ''; } } endif; /** * Returns true if a blog has more than 1 category. * * @return bool */ function trifold_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'trifold_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( 'trifold_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so trifold_categorized_blog should return true. return true; } else { // This blog has only 1 category so trifold_categorized_blog should return false. return false; } } /** * Flush out the transients used in trifold_categorized_blog. */ function trifold_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'trifold_categories' ); } add_action( 'edit_category', 'trifold_category_transient_flusher' ); add_action( 'save_post', 'trifold_category_transient_flusher' ); /** * Get the pagination * * @since 1.0.0 */ function trifold_post_pagination() { $type = get_theme_mod( 'pagination-type', trifold_get_default( 'pagination-type' ) ); switch ( $type ) { case 'numeric': trifold_numeric_posts_nav(); break; default: trifold_standard_posts_nav(); break; } } if( ! function_exists( 'trifold_standard_posts_nav' ) ) : /** * Add custom standard pagination * @return void */ function trifold_standard_posts_nav() { global $wp_query; if( $wp_query->max_num_pages > 1 ) : ?> query_vars['paged'] > 1 ) ? $wp_query->query_vars['paged'] : 1; $total_pages = $wp_query->max_num_pages; $default_link = add_query_arg( 'paged', '%#%', esc_url( get_pagenum_link( 'page' ) ) ); $custom_link = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link(1) ) ) . 'page/%#%/', 'paged' ); $base = ( $wp_rewrite->using_permalinks() ) ? $custom_link : $default_link; $next_text_pagination = is_rtl() ? '«' : '»'; $prev_text_pagination = is_rtl() ? '»' : '«'; $args = array( 'base' => $base, 'format' => '?paged=%#%', 'total' => $total_pages, 'current' => $current_page, 'show_all' => false, 'end_size' => 1, 'mid_size' => 2, 'type' => 'array', 'add_args' => ( ! empty( $wp_query->query_vars['s'] ) ) ? array( 's' => get_query_var( 's' ) ) : '', 'next_text' => $next_text_pagination, 'prev_text' => $prev_text_pagination ); $paging = paginate_links( $args ); if( is_array( $paging ) ){ echo ''; } } endif; /** * Custom post navigation for single posts * * @since 1.0.0 * @return string */ function trifold_post_navigation(){ $navigation = ''; $previous = get_previous_post_link( '', ' %title', true ); $next = get_next_post_link( '', '%title ', true ); // Only add markup if there's somewhere to navigate to. if ( $previous || $next ) { $navigation = _navigation_markup( $previous . $next, 'post-navigation' ); } echo $navigation; } if ( ! function_exists( 'trifold_the_custom_logo' ) ) : /** * Displays the optional custom logo. * * Does nothing if the custom logo is not available. * * @since torte */ function trifold_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } } endif; /** * Add the Yoast SEO breadcrumb, if the plugin is activated. * * @since 1.0.0 * * @return void */ function trifold_display_breadcrumb() { if ( function_exists( 'yoast_breadcrumb' ) ) { yoast_breadcrumb( '

', '

' ); } }