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
Responsive images #657
Merged
Merged
Responsive images #657
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f419a5f
Add support for responsive images
olefredrik ad711d9
Uncomment cleanup reference
olefredrik 027ed5f
Merge in master branch
olefredrik 7378828
Change and test breakpoints
olefredrik 1e19eff
Fix image alignment and caption styling
olefredrik a89d826
Remove inline width and height attr for post thumbs
olefredrik 42762e1
Merge branch 'master' into responsiveImages
olefredrik 0f24291
Fix WP-coding standard sniff violation
olefredrik 6f9fe15
Bump version number
olefredrik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the code comes from this WPShout article but shouldn't custom function in the theme start with the same
foundationpress_
rather than usingwpshout_
from the article?