diff --git a/assets/scss/global/_wp-overrides.scss b/assets/scss/global/_wp-overrides.scss index c2ba87fc1..b6275090a 100755 --- a/assets/scss/global/_wp-overrides.scss +++ b/assets/scss/global/_wp-overrides.scss @@ -1,9 +1,8 @@ -.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{ @@ -11,3 +10,21 @@ p.wp-caption-text{ 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; +} diff --git a/functions.php b/functions.php index 81be7ca58..69700a779 100755 --- a/functions.php +++ b/functions.php @@ -44,5 +44,8 @@ /** Change WP's sticky post class */ require_once( 'library/sticky-posts.php' ); +/** Configure responsive image sizes */ +require_once( 'library/responsive-images.php' ); + /** If your site requires protocol relative url's for theme assets, uncomment the line below */ // require_once( 'library/protocol-relative-theme-assets.php' ); diff --git a/gulpfile.js b/gulpfile.js index 2489e58f2..d9ca045d4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,7 +13,7 @@ var del = require('del'); // Enter URL of your local server here // Example: 'http://localwebsite.dev' -var URL = ''; +var URL = 'foundationpress/'; // Check for --production flag var isProduction = !!(argv.production); diff --git a/library/cleanup.php b/library/cleanup.php index bd5d0be39..bfd434404 100755 --- a/library/cleanup.php +++ b/library/cleanup.php @@ -21,9 +21,6 @@ function foundationpress_start_cleanup() { // Clean up comment styles in the head. add_action( 'wp_head', 'foundationpress_remove_recent_comments_style', 1 ); - // Clean up gallery output in wp. - add_filter( 'foundationpress_gallery_style', 'foundationpress_gallery_style' ); - } add_action( 'after_setup_theme','foundationpress_start_cleanup' ); endif; @@ -100,153 +97,6 @@ function foundationpress_remove_recent_comments_style() { } endif; -// Remove injected CSS from gallery. -if ( ! function_exists( 'foundationpress_gallery_style' ) ) : -function foundationpress_gallery_style( $css ) { - return preg_replace( "!!s", '', $css ); -} -endif; - - -/* - Rebuild the image tag with only the stuff we want - Credit: Brian Gottie - Source: http://blog.skunkbad.com/wordpress/another-look-at-rebuilding-image-tags -*/ - -if ( ! class_exists( 'Foundationpress_img_rebuilder' ) ) : - class Foundationpress_img_rebuilder { - - public $caption_class = 'wp-caption'; - public $caption_p_class = 'wp-caption-text'; - public $caption_id_attr = false; - public $caption_padding = 8; // Double of the padding on $caption_class - - public function __construct() { - add_filter( 'img_caption_shortcode', array( $this, 'img_caption_shortcode' ), 1, 3 ); - add_filter( 'get_avatar', array( $this, 'recreate_img_tag' ) ); - add_filter( 'the_content', array( $this, 'the_content') ); - } - - public function recreate_img_tag( $tag ) { - // Supress SimpleXML errors - libxml_use_internal_errors( true ); - - try { - $x = new SimpleXMLElement( $tag ); - - // We only want to rebuild img tags - if ( $x->getName() == 'img' ) { - - // Get the attributes I'll use in the new tag - $alt = (string) $x->attributes()->alt; - $src = (string) $x->attributes()->src; - $classes = (string) $x->attributes()->class; - $class_segs = explode(' ', $classes); - - // All images have a source - $img = ''; - } else { - $img .= ' />'; - } - - return $img; - } - } - - catch ( Exception $e ) { - if ( defined('WP_DEBUG') && WP_DEBUG ) { - if ( defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY ) { - echo 'Caught exception: ', $e->getMessage(), "\n"; - } - } - } - - // Tag not an img, so just return it untouched - return $tag; - } - - /** - * Search post content for images to rebuild - */ - public function the_content( $html ) { - return preg_replace_callback( - '|(]*>)|', - array( $this, 'the_content_callback' ), - $html - ); - } - - /** - * Rebuild an image in post content - */ - private function the_content_callback( $match ) { - return $this->recreate_img_tag( $match[0] ); - } - - /** - * Customize caption shortcode - */ - public function img_caption_shortcode( $output, $attr, $content ) { - // Not for feed - if ( is_feed() ) { - return $output; - } - - // Set up shortcode atts - $attr = shortcode_atts( array( - 'align' => 'alignnone', - 'caption' => '', - 'width' => '', - ), $attr ); - - // Add id and classes to caption - $attributes = ''; - $caption_id_attr = ''; - - if ( $caption_id_attr && ! empty( $attr['id'] ) ) { - $attributes .= ' id="' . esc_attr( $attr['id'] ) . '"'; - } - - $attributes .= ' class="' . $this->caption_class . ' ' . esc_attr( $attr['align'] ) . '"'; - - // Set the max-width of the caption - $attributes .= ' style="max-width:' . ( $attr['width'] + $this->caption_padding ) . 'px;"'; - - // Create caption HTML - $output = ' -