post_parent ) && $image->post_parent != $id ) $url .= '#main'; return $url; } add_filter( 'attachment_link', 'bonpress_enhanced_image_navigation', 10, 2 ); /** * Filters wp_title to print a neat tag based on what is being viewed. * * @since BonPress 1.1 */ function bonpress_wp_title( $title, $sep ) { global $page, $paged; if ( is_feed() ) return $title; // Add the blog name $title .= get_bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title .= " $sep $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) $title .= " $sep " . sprintf( __( 'Page %s', 'bonpress' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'bonpress_wp_title', 10, 2 ); /** * Filters the author and email field to add a custom "required" message. * * @param array $fields * @return array */ function bonpress_michael_fields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $fields['author'] = '<p class="comment-form-author"><label for="author">' . __( 'Name' ) . ( $req ? sprintf( ' <span class="required">%s</span>', __( 'required', 'bonpress' ) ) : '' ) . '</label> ' . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>'; $fields['email'] = '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? sprintf( ' <span class="required">%s</span>', __( 'required', 'bonpress' ) ) : '' ) . '</label> ' . '<input id="email" name="email" type="email" pattern="" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>'; return $fields; } add_filter( 'comment_form_default_fields', 'bonpress_michael_fields' ); /** * Makes the caption as wide as the image. * * @param array $atts Attribute list. * @return array Filtered attributes. */ function bonpress_caption_atts( $atts ) { // Remove 10px that will be added by the caption shortcode. if ( isset( $atts['width'] ) && is_numeric( $atts['width'] ) ) { $atts['width'] = $atts['width'] - 10; } return $atts; } add_filter( 'shortcode_atts_caption', 'bonpress_caption_atts' ); /** * Switches default core markup for search form to output valid HTML5. * * @param string $format Expected markup format, default is `xhtml` * @return string Bonpress loves HTML5. */ function bonpress_searchform_format( $format ) { return 'html5'; } add_filter( 'search_form_format', 'bonpress_searchform_format' );