post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } } // Don't print empty markup in archives if there's only one page. if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ) ) { return; } $nav_class = ( is_single() ) ? 'post-navigation' : 'paging-navigation'; ?> %3$s'; } return $template; } } /** * Output requested post meta. * * @since 2.3 * * @param string $item The post meta item we're requesting * @return The requested HTML. */ function generate_do_post_meta_item( $item ) { if ( 'date' === $item ) { $date = apply_filters( 'generate_post_date', true ); $time_string = ''; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '' . $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() ) ); // If our date is enabled, show it. if ( $date ) { echo apply_filters( 'generate_post_date_output', sprintf( // WPCS: XSS ok, sanitization ok. '%1$s%4$s ', apply_filters( 'generate_inside_post_meta_item_output', '', 'date' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), $time_string ), $time_string ); } } if ( 'author' === $item ) { $author = apply_filters( 'generate_post_author', true ); if ( $author ) { echo apply_filters( 'generate_post_author_output', sprintf( ' ', apply_filters( 'generate_inside_post_meta_item_output', '', 'author' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), /* translators: 1: Author name */ esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), generate_get_microdata( 'post-author' ) ) ); } } if ( 'categories' === $item ) { $categories = apply_filters( 'generate_show_categories', true ); $term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'categories' ); $categories_list = get_the_category_list( $term_separator ); if ( $categories_list && $categories ) { echo apply_filters( 'generate_category_list_output', sprintf( '%3$s%1$s %2$s ', // WPCS: XSS ok, sanitization ok. esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ), $categories_list, apply_filters( 'generate_inside_post_meta_item_output', '', 'categories' ) ) ); } } if ( 'tags' === $item ) { $tags = apply_filters( 'generate_show_tags', true ); $term_separator = apply_filters( 'generate_term_separator', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ), 'tags' ); $tags_list = get_the_tag_list( '', $term_separator ); if ( $tags_list && $tags ) { echo apply_filters( 'generate_tag_list_output', sprintf( ' ', // WPCS: XSS ok, sanitization ok. esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ), $tags_list, apply_filters( 'generate_inside_post_meta_item_output', '', 'tags' ) ) ); } } if ( 'comments-link' === $item ) { $comments = apply_filters( 'generate_show_comments', true ); if ( $comments && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; echo apply_filters( 'generate_inside_post_meta_item_output', '', 'comments-link' ); comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); echo ' '; } } /** * generate_post_meta_items hook. * * @since 2.4 */ do_action( 'generate_post_meta_items', $item ); } add_filter( 'generate_inside_post_meta_item_output', 'generate_do_post_meta_prefix', 10, 2 ); /** * Add svg icons or text to our post meta output. * * @since 2.4 */ function generate_do_post_meta_prefix( $output, $item ) { if ( 'author' === $item ) { $output = __( 'by', 'generatepress' ) . ' '; } if ( 'categories' === $item ) { $output = generate_get_svg_icon( 'categories' ); } if ( 'tags' === $item ) { $output = generate_get_svg_icon( 'tags' ); } if ( 'comments-link' === $item ) { $output = generate_get_svg_icon( 'comments' ); } return $output; } if ( ! function_exists( 'generate_posted_on' ) ) { /** * Prints HTML with meta information for the current post-date/time and author. * * @since 0.1 */ function generate_posted_on() { $items = apply_filters( 'generate_header_entry_meta_items', array( 'date', 'author', ) ); foreach ( $items as $item ) { generate_do_post_meta_item( $item ); } } } if ( ! function_exists( 'generate_entry_meta' ) ) { /** * Prints HTML with meta information for the categories, tags. * * @since 1.2.5 */ function generate_entry_meta() { $items = apply_filters( 'generate_footer_entry_meta_items', array( 'categories', 'tags', 'comments-link', ) ); foreach ( $items as $item ) { generate_do_post_meta_item( $item ); } } } if ( ! function_exists( 'generate_excerpt_more' ) ) { add_filter( 'excerpt_more', 'generate_excerpt_more' ); /** * Prints the read more HTML to post excerpts. * * @since 0.1 * * @param string $more The string shown within the more link. * @return string The HTML for the more link. */ function generate_excerpt_more( $more ) { return apply_filters( 'generate_excerpt_more_output', sprintf( ' ... %3$s %4$s', the_title_attribute( 'echo=0' ), esc_url( get_permalink( get_the_ID() ) ), __( 'Read more', 'generatepress' ), '' . get_the_title() . '' ) ); } } if ( ! function_exists( 'generate_content_more' ) ) { add_filter( 'the_content_more_link', 'generate_content_more' ); /** * Prints the read more HTML to post content using the more tag. * * @since 0.1 * * @param string $more The string shown within the more link. * @return string The HTML for the more link */ function generate_content_more( $more ) { return apply_filters( 'generate_content_more_link_output', sprintf( '
', the_title_attribute( 'echo=0' ), esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ), __( 'Read more', 'generatepress' ), '' . get_the_title() . '' ) ); } } if ( ! function_exists( 'generate_post_meta' ) ) { add_action( 'generate_after_entry_title', 'generate_post_meta' ); /** * Build the post meta. * * @since 1.3.29 */ function generate_post_meta() { $post_types = apply_filters( 'generate_entry_meta_post_types', array( 'post', ) ); if ( in_array( get_post_type(), $post_types ) ) : ?>