',
'context' => 'entry-pagination',
'echo' => false,
) ),
'link_before' => genesis_a11y( 'screen-reader-text' ) ? '' . __( 'Page ', 'genesis' ) . '' : '',
) );
}
add_action( 'genesis_entry_content', 'genesis_do_post_permalink', 14 );
add_action( 'genesis_post_content', 'genesis_do_post_permalink' );
/**
* Show permalink if no title.
*
* If the entry has no title, this is a way to display a link to the full post.
*
* Applies the `genesis_post_permalink` filter.
*
* @since 2.0.0
*/
function genesis_do_post_permalink() {
// Don't show on singular views, or if the entry has a title.
if ( is_singular() || get_the_title() ) {
return;
}
$permalink = get_permalink();
echo apply_filters( 'genesis_post_permalink', sprintf( '
', esc_url( $permalink ), esc_html( $permalink ) ) );
}
add_action( 'genesis_loop_else', 'genesis_do_noposts' );
/**
* Echo filterable content when there are no posts to show.
*
* The applied filter is `genesis_noposts_text`.
*
* @since 1.1.0
*/
function genesis_do_noposts() {
printf( '
%s
', apply_filters( 'genesis_noposts_text', __( 'Sorry, no content matched your criteria.', 'genesis' ) ) );
}
add_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
/**
* Echo the opening structural markup for the entry footer.
*
* @since 2.0.0
*/
function genesis_entry_footer_markup_open() {
if ( post_type_supports( get_post_type(), 'genesis-entry-meta-after-content' ) ) {
printf( '';
}
}
add_filter( 'genesis_post_meta', 'do_shortcode', 20 );
add_action( 'genesis_entry_footer', 'genesis_post_meta' );
add_action( 'genesis_after_post_content', 'genesis_post_meta' );
/**
* Echo the post meta after the post content.
*
* By default, does post meta on all public post types except page.
*
* The post info makes use of a couple of shortcodes by default, and the whole output is filtered via
* `genesis_post_meta` before echoing.
*
* @since 1.0.0
*
* @return void Return early if post type lacks support for `genesis-entry-meta-after-content`.
*/
function genesis_post_meta() {
if ( ! post_type_supports( get_post_type(), 'genesis-entry-meta-after-content' ) ) {
return;
}
$filtered = apply_filters( 'genesis_post_meta', '[post_categories] [post_tags]' );
if ( false == trim( $filtered ) ) {
return;
}
$output = genesis_markup( array(
'open' => '
',
'close' => '
',
'content' => genesis_strip_p_tags( $filtered ),
'context' => 'entry-meta-after-content',
) );
}
add_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
add_action( 'genesis_after_post', 'genesis_do_author_box_single' );
/**
* Conditionally add the author box after single posts or pages.
*
* @since 1.0.0
*
* @return void Return early if not a single post or page, or post type does not support `author`.
*/
function genesis_do_author_box_single() {
if ( ! is_single() || ! post_type_supports( get_post_type(), 'author' ) ) {
return;
}
if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta( 'ID' ) ) ) {
genesis_author_box( 'single' );
}
}
/**
* Echo the the author box and its contents.
*
* The title is filterable via `genesis_author_box_title`, and the gravatar size is filterable via
* `genesis_author_box_gravatar_size`.
*
* The final output is filterable via `genesis_author_box`, which passes many variables through.
*
* @since 1.3.0
*
* @global WP_User $authordata Author (user) object.
*
* @param string $context Optional. Allows different author box markup for different contexts, specifically 'single'.
* Default is empty string.
* @param bool $echo Optional. If true, the author box will echo. If false, it will be returned.
* @return string HTML for author box if `$echo` param is falsy.
*/
function genesis_author_box( $context = '', $echo = true ) {
global $authordata;
$authordata = is_object( $authordata ) ? $authordata : get_userdata( get_query_var( 'author' ) );
$gravatar_size = apply_filters( 'genesis_author_box_gravatar_size', 70, $context );
$gravatar = get_avatar( get_the_author_meta( 'email' ), $gravatar_size );
$description = wpautop( get_the_author_meta( 'description' ) );
// The author box markup, contextual.
if ( genesis_html5() ) {
$title = __( 'About', 'genesis' ) . ' ' . get_the_author() . '';
/**
* Author box title filter.
*
* Allows you to filter the title of the author box. $context passed as second parameter to allow for contextual filtering.
*
* @since unknown
*
* @param string $title Assembled Title.
* @param string $context Context.
*/
$title = apply_filters( 'genesis_author_box_title', $title, $context );
$heading_element = 'h1';
if ( 'single' === $context && ! genesis_get_seo_option( 'semantic_headings' ) ) {
$heading_element = 'h4';
} elseif ( genesis_a11y( 'headings' ) || get_the_author_meta( 'headline', (int) get_query_var( 'author' ) ) ) {
$heading_element = 'h4';
}
$pattern = sprintf( '', genesis_attr( 'author-box' ) );
$pattern .= '%s<' . $heading_element . ' class="author-box-title">%s' . $heading_element . '>';
$pattern .= '
',
'content' => $pagination,
'context' => 'archive-pagination',
) );
}
}
/**
* Echo archive pagination in page numbers format.
*
* Applies the `genesis_prev_link_text` and `genesis_next_link_text` filters.
*
* The links, if needed, are ordered as:
*
* * previous page arrow,
* * first page,
* * up to two pages before current page,
* * current page,
* * up to two pages after the current page,
* * last page,
* * next page arrow.
*
* @since 1.0.0
*
* @global WP_Query $wp_query Query object.
*
* @return void Return early if on a single post or page, or only one page exists.
*/
function genesis_numeric_posts_nav() {
if( is_singular() ) {
return;
}
global $wp_query;
// Stop execution if there's only one page.
if( $wp_query->max_num_pages <= 1 ) {
return;
}
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = (int) $wp_query->max_num_pages;
// Add current page to the array.
if ( $paged >= 1 ) {
$links[] = $paged;
}
// Add the pages around the current page to the array.
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
genesis_markup( array(
'open' => '
',
'context' => 'adjacent-entry-pagination',
) );
}
/**
* Helper function to display adjacent entry navigation on single posts. Must be hooked to `genesis_after_entry` at priority 10 or earlier to work properly.
*
* @since 1.5.1
*/
function genesis_prev_next_post_nav() {
add_post_type_support( 'post', 'genesis-adjacent-entry-nav' );
}