widgets['WP_Widget_Recent_Comments'])) { remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style')); } } // remove injected CSS from gallery function pf_gallery_style($css) { return preg_replace("!!s", '', $css); } /** * Loads modernizr, html5shiv, and foundation javascript * * @todo: Consider loading google cdn version of jquery * @todo: Consider loading only relevant foundation javascript instead of the whole thing * */ function pf_scripts_and_styles() { if (!is_admin()) { // comment reply script for threaded comments if( get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // enqueue styles and scripts wp_enqueue_script( 'pf-modernizr', get_template_directory_uri() . '/foundation/bower_components/modernizr/modernizr.js', array(), null, false ); wp_enqueue_script( 'pf-js', get_template_directory_uri() . '/foundation/bower_components/foundation/js/foundation.min.js', array( 'jquery' ), '', true ); global $is_IE; if ($is_IE) { wp_enqueue_script ( 'html5shiv', "http://html5shiv.googlecode.com/svn/trunk/html5.js" , false, true); } } } /** * Adding the conditional wrapper around ie stylesheet * * @link source: http://code.garyjones.co.uk/ie-conditional-style-sheets-wordpress/ * */ function pf_ie_conditional( $tag, $handle ) { if ( 'pf-ie-only' == $handle ) $tag = '' . "\n"; return $tag; } /** * Customize the output of caption. * * Thanks to DevPress. * * @link: http://devpress.com/blog/captions-in-wordpress/ Captions in Wordpress * */ function pf_cleaner_caption( $output, $attr, $content ) { /* We're not worried abut captions in feeds, so just return the output here. */ if ( is_feed() ) return $output; /* Set up the default arguments. */ $defaults = array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ); /* Merge the defaults with user input. */ $attr = shortcode_atts( $defaults, $attr ); /* If the width is less than 1 or there is no caption, return the content wrapped between the [caption]< tags. */ if ( 1 > $attr['width'] || empty( $attr['caption'] ) ) return $content; /* Set up the attributes for the caption
. */ $attributes = ' class="figure ' . esc_attr( $attr['align'] ) . '"'; /* Open the caption
. */ $output = ''; /* Allow shortcodes for the content the caption was created for. */ $output .= do_shortcode( $content ); /* Append the caption text. */ $output .= '
' . $attr['caption'] . '
'; /* Close the caption
. */ $output .= ''; /* Return the formatted, clean caption. */ return $output; } /** * Clean the output of attributes of images in editor. * * Thanks to SitePoint. * * @link http://www.sitepoint.com/wordpress-change-img-tag-html/ SitePoint * */ function pf_image_tag_class($class, $id, $align, $size) { $align = 'align' . esc_attr($align); return $align; } // Remove width and height in editor, for a better responsive world. function pf_image_editor($html, $id, $alt, $title) { return preg_replace(array( '/\s+width="\d+"/i', '/\s+height="\d+"/i', '/alt=""/i' ), array( '', '', '', 'alt="' . $title . '"' ), $html); } /** * Wrap images with figure tag. * * Thanks to Interconnectit * * @link: http://interconnectit.com/2175/how-to-remove-p-tags-from-images-in-wordpress/ Interconnectit * */ function pf_img_unautop($pee) { $pee = preg_replace('/

\\s*?(<\\/a>|)?\\s*<\\/p>/s', '

$1
', $pee); return $pee; } ?>