From 8c0f68a5a1fba8233067b52caad020496ce9fd21 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Thu, 28 Feb 2013 18:33:39 +0000 Subject: [PATCH] Twenty Thirteen: usability improvement for better viewing of images on attachment pages. Props DrewAPicture and obenland, fixes #23543. git-svn-id: https://develop.svn.wordpress.org/trunk@23523 602fd350-edb4-49c9-b593-d223f7449a82 --- .../themes/twentythirteen/functions.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wp-content/themes/twentythirteen/functions.php b/wp-content/themes/twentythirteen/functions.php index 0c13d6afd9..a34121a2e1 100644 --- a/wp-content/themes/twentythirteen/functions.php +++ b/wp-content/themes/twentythirteen/functions.php @@ -560,6 +560,25 @@ function twentythirteen_aside_date( $content ) { } add_filter( 'the_content', 'twentythirteen_aside_date', 8 ); // After embeds, before everything else. +/** + * Usability improvement for better viewing of images on attachment pages. + * + * Moves the focus down to the main content area to by appending an in-page + * anchor to attachment link URLs. + * + * @since Twenty Thirteen 1.0 + * + * @param string $url The image attachment URL + * @return string URL with extra anchor appended. + */ +function twentythirteen_attachment_link( $url ) { + if ( wp_attachment_is_image() ) + $url .= '#main'; + + return $url; +} +add_filter( 'attachment_link', 'twentythirteen_attachment_link' ); + /** * Add postMessage support for site title and description for the Customizer. *