This repository has been archived by the owner on Sep 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 865
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #657 from olefredrik/responsiveImages
Responsive images
- Loading branch information
Showing
10 changed files
with
87 additions
and
168 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
.wp-caption{ | ||
padding:rem-calc(4); | ||
} | ||
|
||
.wp-caption img{ | ||
max-width:100%; | ||
.wp-caption > figcaption { | ||
max-width: 100%; | ||
font-size: 0.8rem; | ||
color: #999; | ||
padding: 0.25rem 0; | ||
} | ||
|
||
p.wp-caption-text{ | ||
font-size:90%; | ||
color: #666; | ||
padding:rem-calc(10) 0; | ||
} | ||
|
||
.alignleft { | ||
float: left; | ||
padding-right: 1rem; | ||
margin: 0; | ||
} | ||
|
||
.alignright { | ||
float: right; | ||
padding-left: 1rem; | ||
margin: 0; | ||
} | ||
|
||
.aligncenter { | ||
display: block; | ||
margin-left: auto; | ||
margin-right: auto; | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Configure responsive images sizes | ||
* | ||
* @package WordPress | ||
* @subpackage FoundationPress | ||
* @since FoundationPress 2.6.0 | ||
*/ | ||
|
||
// Add additional image sizes | ||
add_image_size( 'fp-small', 640 ); | ||
add_image_size( 'fp-medium', 1024 ); | ||
add_image_size( 'fp-large', 1200 ); | ||
|
||
// Register the new image sizes for use in the add media modal in wp-admin | ||
add_filter( 'image_size_names_choose', 'wpshout_custom_sizes' ); | ||
function wpshout_custom_sizes( $sizes ) { | ||
return array_merge( $sizes, array( | ||
'fp-small' => __( 'FP Small' ), | ||
'fp-medium' => __( 'FP Medium' ), | ||
'fp-large' => __( 'FP Large' ), | ||
) ); | ||
} | ||
|
||
// Add custom image sizes attribute to enhance responsive image functionality for content images | ||
function foundationpress_adjust_image_sizes_attr( $sizes, $size ) { | ||
$sizes = ' | ||
(max-width: 640px) 640px, | ||
(max-width: 1024px) 1024px, | ||
(max-width: 1200px) 1200px, | ||
(min-width: 1201px) 1200px, 100vw'; | ||
return $sizes; | ||
} | ||
add_filter( 'wp_calculate_image_sizes', 'foundationpress_adjust_image_sizes_attr', 10 , 2 ); | ||
|
||
|
||
// Remove inline width and height attributes for post thumbnails | ||
function remove_thumbnail_dimensions( $html, $post_id, $post_image_id ) { | ||
$html = preg_replace( '/(width|height)=\"\d*\"\s/', '', $html ); | ||
return $html; | ||
} | ||
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10, 3 ); |
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
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
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
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