Created
June 10, 2013 22:44
-
-
Save rfmeier/5753101 to your computer and use it in GitHub Desktop.
Change the image size on the attachment page in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
add_filter( 'prepend_attachment', 'custom_prepend_attachment' ); | |
/** | |
* Callback for WordPress 'prepend_attachment' filter. | |
* | |
* Change the attachment page image size to 'large' | |
* | |
* @package WordPress | |
* @category Attachment | |
* @see wp-includes/post-template.php | |
* | |
* @param string $attachment_content the attachment html | |
* @return string $attachment_content the attachment html | |
*/ | |
function custom_prepend_attachment( $attachment_content ){ | |
// set the attachment image size to 'large' | |
$attachment_content = sprintf( '<p>%s</p>', wp_get_attachment_link(0, 'large', false) ); | |
// return the attachment content | |
return $attachment_content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment