// Register a custom image size for featured images on single Posts add_image_size( 'post-single', 1200, 300, true ); // Create a shortcode that outputs the URL of author page for the entry author outside the loop add_shortcode( 'post_author_posts_link_outside_loop', 'sk_post_author_posts_link_shortcode' ); /** * Produces the author of the post (link to author archive). * * Supported shortcode attributes are: * after (output after link, default is empty string), * before (output before link, default is empty string). * * Output passes through 'genesis_post_author_posts_link_shortcode' filter before returning. * * @since 1.1.0 * * @param array|string $atts Shortcode attributes. Empty string if no attributes. * @return string Shortcode output */ function sk_post_author_posts_link_shortcode( $atts ) { if ( ! is_singular() ) { return; } $defaults = array( 'after' => '', 'before' => '', ); $atts = shortcode_atts( $defaults, $atts, 'post_author_posts_link_outside_loop' ); global $post; $author_id = $post->post_author; $author = get_the_author_meta( 'display_name', $author_id ); $url = get_author_posts_url( $author_id ); if ( genesis_html5() ) { $output = sprintf( '', genesis_attr( 'entry-author' ) ); $output .= $atts['before']; $output .= sprintf( '', $url, genesis_attr( 'entry-author-link' ) ); $output .= sprintf( '', genesis_attr( 'entry-author-name' ) ); $output .= esc_html( $author ); $output .= '' . $atts['after'] . ''; } else { $link = sprintf( '', esc_url( $url ), esc_html( $author ) ); $output = sprintf( '%2$s%1$s%3$s', $link, $atts['before'], $atts['after'] ); } return apply_filters( 'genesis_post_author_posts_link_shortcode', $output, $atts ); }