Skip to content

Instantly share code, notes, and snippets.

View wp-freund's full-sized avatar

wp-freund

View GitHub Profile
@wp-freund
wp-freund / InstantWP Browser Preference
Created August 21, 2016 13:09 — forked from smallbizgeek/InstantWP Browser Preference
InstantWP Browser Configuration
[Browser]
BrowserType=EXTERNAL
BrowserCommandOptions=
BrowserPath= C:\Program Files\Mozilla Firefox\firefox.exe
WorkOfflineTitle=InstantWP
BrowserSize=
@wp-freund
wp-freund / wp-automated-cache-busting.php
Created August 11, 2016 15:39 — forked from kjbrum/wp-automated-cache-busting.php
Automated Cache Busting. This works by adding the file's change time to the end of the URL (last argument of the call)
<?php
/* For Themes */
wp_enqueue_style('slug', get_template_directory_uri().'/css/slug.css', array(), filemtime(get_template_directory().'/css/slug.css'));
wp_enqueue_script('slug', get_template_directory_uri().'/js/slug.js', array(), filemtime(get_template_directory().'/js/slug.js'));
/* For Plugins */
wp_enqueue_style('slug', plugin_dir_url(__FILE__).'css/slug.css', array(), filemtime(plugin_dir_path(__FILE__).'css/slug.css'));
wp_enqueue_script('slug', plugin_dir_url(__FILE__).'js/slug.js', array(), filemtime(plugin_dir_path(__FILE__).'js/slug.js'));
@wp-freund
wp-freund / livereload-wp-plugin
Created July 31, 2015 21:33
livereload.js in wordpress
if (in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
wp_register_script('livereload', 'http://localhost:35729/livereload.js?snipver=1', null, false, true);
wp_enqueue_script('livereload');
}
/*from http://robandlauren.com/2014/02/05/live-reload-grunt-wordpress/ */
function wp_enqueue_woocommerce_style(){
wp_register_style( 'mytheme-woocommerce', get_template_directory_uri() . '/css/woocommerce.css' );
if ( class_exists( 'woocommerce' ) ) {
wp_enqueue_style( 'mytheme-woocommerce' );
}
}
add_action( 'wp_enqueue_scripts', 'wp_enqueue_woocommerce_style' );
// Remove each style one by one
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
// Or just remove them all in one line
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
<?php if ( has_post_thumbnail() ) :?>
<a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
'alt' => trim(strip_tags( $post->post_title )),
'title' => trim(strip_tags( $post->post_title )),
)); ?></a>
<?php endif; ?>