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 kr8_gallery_style($css) {
return preg_replace("!!s", '', $css);
}
/*********************
SCRIPTS & ENQUEUEING
*********************/
// loading modernizr and jquery, and reply script
function kr8_scripts_and_styles() {
if (!is_admin()) {
// modernizr (without media query polyfill)
wp_register_script( 'kr8-modernizr', get_template_directory_uri() . '/lib/js/libs/modernizr.custom.min.js', array(), '2.5.3', false );
wp_register_script( 'kr8-fancybox', get_template_directory_uri() . '/lib/js/libs/fancybox/jquery.fancybox.pack.js', array(), '2.1.4', false );
wp_register_script( 'kr8-tabs', get_template_directory_uri() . '/lib/js/responsiveTabs.min.js', array(), '2.1.4', false );
// comment reply script for threaded comments
if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
wp_enqueue_script( 'comment-reply' );
}
//adding scripts file in the footer
wp_register_script( 'kr8-js', get_template_directory_uri() . '/lib/js/scripts.js', array( 'jquery' ), '', true );
wp_register_script( 'kr8-waypoints-js', get_template_directory_uri() . '/lib/js/libs/waypoints.js', array( 'jquery' ), '', true );
// register main stylesheet
wp_register_style( 'kr8-stylesheet', get_template_directory_uri() . '/lib/css/style.css', array(), '', 'all' );
wp_register_style( 'kr8-fontawesome', get_template_directory_uri() . '/lib/css/font-awesome.min.css', array(), '', 'all' );
wp_register_style( 'kr8-fancycss', get_template_directory_uri() . '/lib/js/libs/fancybox/fancybox.min.css', array(), '', 'all' );
// ie-only style sheet
wp_register_style( 'kr8-ie-only', get_template_directory_uri() . '/lib/css/ie.css', array(), '' );
// enqueue styles and scripts
wp_enqueue_script( 'kr8-modernizr' );
wp_enqueue_style( 'kr8-fontawesome' );
wp_enqueue_style( 'kr8-stylesheet' );
wp_enqueue_style( 'kr8-fancycss' );
wp_enqueue_style( 'kr8-fancybuttoncss' );
wp_enqueue_style('kr8-ie-only');
/*
I recommend using a plugin to call jQuery
using the google cdn. That way it stays cached
and your site will load faster.
*/
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'kr8-waypoints-js' );
wp_enqueue_script( 'kr8-js' );
wp_enqueue_script( 'kr8-fancybox' );
wp_enqueue_script( 'kr8-tabs' );
}
}
// adding the conditional wrapper around ie stylesheet
// source: http://code.garyjones.co.uk/ie-conditional-style-sheets-wordpress/
function kr8_ie_conditional( $tag, $handle ) {
if ( 'kr8-ie-only' == $handle )
$tag = '' . "\n";
return $tag;
}
/*********************
PERFORMANCE
*********************/
class WP_HTML_Compression {
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
protected $remove_comments = true;
protected $html;
public function __construct($html) {
if (!empty($html)) {
$this->parseHTML($html);
}
}
public function __toString() {
return $this->html;
}
protected function bottomComment($raw, $compressed) {
$raw = strlen($raw);
$compressed = strlen($compressed);
$savings = ($raw-$compressed) / $raw * 100;
$savings = round($savings, 2);
return '';
}
protected function minifyHTML($html) {
$pattern = '/<(?