%s', get_permalink(), sprintf( '%s/images/post-formats/%s.png', CHILD_URL, $post_format ), $post_format ); } // Else, look for the default post format image. elseif ( file_exists( sprintf( '%s/images/post-formats/default.png', CHILD_DIR ) ) ) { printf( '%s', get_permalink(), CHILD_URL, 'post' ); } } add_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); /** * Echo the opening structural markup for the entry header. * * @since 2.0.0 */ function genesis_entry_header_markup_open() { printf( '
', genesis_attr( 'entry-header' ) ); } add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); /** * Echo the closing structural markup for the entry header. * * @since 2.0.0 */ function genesis_entry_header_markup_close() { echo '
'; } add_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_post_title', 'genesis_do_post_title' ); /** * Echo the title of a post. * * The `genesis_post_title_text` filter is applied on the text of the title, while the `genesis_post_title_output` * filter is applied on the echoed markup. * * @since 1.1.0 * * @return void Return early if the length of the title string is zero. */ function genesis_do_post_title() { $title = apply_filters( 'genesis_post_title_text', get_the_title() ); if ( 0 === mb_strlen( $title ) ) { return; } // Link it, if necessary. if ( ! is_singular() && apply_filters( 'genesis_link_post_title', true ) ) { $title = genesis_markup( array( 'open' => '', 'close' => '', 'content' => $title, 'context' => 'entry-title-link', 'echo' => false, ) ); } // Wrap in H1 on singular pages. $wrap = is_singular() ? 'h1' : 'h2'; // Also, if HTML5 with semantic headings, wrap in H1. $wrap = genesis_html5() && genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap; /** * Entry title wrapping element. * * The wrapping element for the entry title. * * @since 2.2.3 * * @param string $wrap The wrapping element (h1, h2, p, etc.). */ $wrap = apply_filters( 'genesis_entry_title_wrap', $wrap ); // Build the output. $output = genesis_markup( array( 'open' => "<{$wrap} %s>", 'close' => "", 'content' => $title, 'context' => 'entry-title', 'params' => array( 'wrap' => $wrap, ), 'echo' => false, ) ); echo apply_filters( 'genesis_post_title_output', $output, $wrap, $title ) . "\n"; } add_filter( 'genesis_post_info', 'do_shortcode', 20 ); add_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action( 'genesis_before_post_content', 'genesis_post_info' ); /** * Echo the post info (byline) under the post title. * * By default, only does post info on posts. * * The post info makes use of several shortcodes by default, and the whole output * is filtered via `genesis_post_info` before echoing. * * @since 1.0.0 * * @return void Return early if post type lacks support for `genesis-entry-meta-before-content`. */ function genesis_post_info() { if ( ! post_type_supports( get_post_type(), 'genesis-entry-meta-before-content' ) ) { return; } $filtered = apply_filters( 'genesis_post_info', '[post_date] ' . __( 'by', 'genesis' ) . ' [post_author_posts_link] [post_comments] [post_edit]' ); if ( false == trim( $filtered ) ) { return; } genesis_markup( array( 'open' => '

', 'close' => '

', 'content' => genesis_strip_p_tags( $filtered ), 'context' => 'entry-meta-before-content', ) ); } add_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); add_action( 'genesis_post_content', 'genesis_do_post_image' ); /** * Echo the post image on archive pages. * * If this an archive page and the option is set to show thumbnail, then it gets the image size as per the theme * setting, wraps it in the post permalink and echoes it. * * @since 1.1.0 */ function genesis_do_post_image() { if ( ! is_singular() && genesis_get_option( 'content_archive_thumbnail' ) ) { $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'context' => 'archive', 'attr' => genesis_parse_attr( 'entry-image', array( 'alt' => get_the_title(), ) ), ) ); if ( ! empty( $img ) ) { genesis_markup( array( 'open' => '', 'close' => '', 'content' => wp_make_content_images_responsive( $img ), 'context' => 'entry-image-link', ) ); } } } add_action( 'genesis_entry_content', 'genesis_do_post_content' ); add_action( 'genesis_post_content', 'genesis_do_post_content' ); /** * Echo the post content. * * On single posts or pages it echoes the full content, and optionally the trackback string if enabled. On single pages, * also adds the edit link after the content. * * Elsewhere it displays either the excerpt, limited content, or full content. * * Applies the `genesis_edit_post_link` filter. * * @since 1.1.0 */ function genesis_do_post_content() { if ( is_singular() ) { the_content(); if ( is_single() && 'open' === get_option( 'default_ping_status' ) && post_type_supports( get_post_type(), 'trackbacks' ) ) { echo '' . "\n"; } if ( is_page() && apply_filters( 'genesis_edit_post_link', true ) ) { edit_post_link( __( '(Edit)', 'genesis' ), '', '' ); } } elseif ( 'excerpts' === genesis_get_option( 'content_archive' ) ) { the_excerpt(); } else { if ( genesis_get_option( 'content_archive_limit' ) ) { the_content_limit( (int) genesis_get_option( 'content_archive_limit' ), genesis_a11y_more_link( __( '[Read more...]', 'genesis' ) ) ); } else { the_content( genesis_a11y_more_link( __( '[Read more...]', 'genesis' ) ) ); } } } add_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 ); add_action( 'genesis_post_content', 'genesis_do_post_content_nav' ); /** * Display page links for paginated posts (i.e. includes the Quicktag one or more times). * * @since 2.0.0 */ function genesis_do_post_content_nav() { wp_link_pages( array( 'before' => genesis_markup( array( 'open' => '
', 'context' => 'entry-pagination', 'echo' => false, ) ) . __( 'Pages:', 'genesis' ), 'after' => genesis_markup( array( 'close' => '
', '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( '

%s

', 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'; $pattern .= '
%s
'; $pattern .= '
'; } else { $title = apply_filters( 'genesis_author_box_title', sprintf( '%s %s', __( 'About', 'genesis' ), get_the_author() ), $context ); $pattern = '
%s

%s

%s
'; if ( 'single' === $context || get_the_author_meta( 'headline', (int) get_query_var( 'author' ) ) ) { $pattern = '
%s %s
%s
'; } } $output = sprintf( $pattern, $gravatar, $title, $description ); /** * Author box output filter. * * Allows you to filter the full output of the author box. * * @since unknown * * @param string $output Assembled output. * @param string $context Context. * @param string $pattern (s)printf pattern. * @param string $context Gravatar. * @param string $context Title. * @param string $context Description. */ $output = apply_filters( 'genesis_author_box', $output, $context, $pattern, $gravatar, $title, $description ); if ( $echo ) { echo $output; return null; } else { return $output; } } add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' ); /** * Display after-entry widget area on the genesis_after_entry action hook. * * @since 2.1.0 * * @return void Return early if not singular, or post type does not support after entry widget area. */ function genesis_after_entry_widget_area() { if ( ! is_singular() || ! post_type_supports( get_post_type(), 'genesis-after-entry-widget-area' ) ) { return; } genesis_widget_area( 'after-entry', array( 'before' => '
', 'after' => '
', ) ); } add_action( 'genesis_after_endwhile', 'genesis_posts_nav' ); /** * Conditionally echo archive pagination in a format dependent on chosen setting. * * This is shown at the end of archives to get to another page of entries. * * @since 1.0.0 */ function genesis_posts_nav() { if ( 'numeric' === genesis_get_option( 'posts_nav' ) ) { genesis_numeric_posts_nav(); } else { genesis_prev_next_posts_nav(); } } /** * Echo archive pagination in Previous Posts / Next Posts format. * * Applies `genesis_prev_link_text` and `genesis_next_link_text` filters. * * @since 1.0.0 */ function genesis_prev_next_posts_nav() { $prev_link = get_previous_posts_link( apply_filters( 'genesis_prev_link_text', '« ' . __( 'Previous Page', 'genesis' ) ) ); $next_link = get_next_posts_link( apply_filters( 'genesis_next_link_text', __( 'Next Page', 'genesis' ) . ' »' ) ); if ( $prev_link || $next_link ) { $pagination = $prev_link ? sprintf( '
%s
', $prev_link ) : ''; $pagination .= $next_link ? sprintf( '
%s
', $next_link ) : ''; genesis_markup( array( 'open' => '
', 'close' => '
', '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' => 'archive-pagination', ) ); $before_number = genesis_a11y( 'screen-reader-text' ) ? '' . __( 'Page ', 'genesis' ) . '' : ''; echo ''; genesis_markup( array( 'close' => '
', 'context' => 'archive-pagination', ) ); echo "\n"; } add_action( 'genesis_after_entry', 'genesis_adjacent_entry_nav' ); /** * Display links to previous and next entry. * * @since 2.3.0 * * @return void Return early if not singular or post type doesn't support `genesis-adjacent-entry-nav`. */ function genesis_adjacent_entry_nav() { if ( ! is_singular() || ! post_type_supports( get_post_type(), 'genesis-adjacent-entry-nav' ) ) { return; } genesis_markup( array( 'open' => '
', 'context' => 'adjacent-entry-pagination', ) ); echo '
'; previous_post_link( '%link', '« %title' ); echo '
'; echo '
'; next_post_link( '%link', '%title »' ); echo '
'; genesis_markup( array( 'close' => '
', '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' ); }