Skip to content

Instantly share code, notes, and snippets.

View Willem-Siebe's full-sized avatar

Willem-Siebe

View GitHub Profile
@Willem-Siebe
Willem-Siebe / functions.php
Last active August 29, 2015 14:00
Loads the Pinterest JavaScript asynchronously. I add this to my WordPress website with wp_head, but you can copy and paste this snippet anywhere on your page. You only need to load this script once per page, no matter how many buttons or widgets you use. See: https://developers.pinterest.com/pin_it/. I also added a line to set the data-pin-hover…
// Add Pinterest Javascript to your website, see https://gist.github.com/Willem-Siebe/11351787.
function wsis_add_pinterest_script() {
?>
<script type="text/javascript">
(function(d){
var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
p.type = 'text/javascript';
p.async = true;
p.setAttribute('data-pin-hover', true);
@Willem-Siebe
Willem-Siebe / robots.txt
Last active August 29, 2015 14:00
The ideal Robots.txt for your WordPress website (staging and development sites as well). See http://spoelstra.ws/crawlen-indexeren-robots-txt-wordpress/ (in Dutch).
# The ideal Robots.txt for your WordPress website, see https://gist.github.com/Willem-Siebe/11368429.
User-Agent: *
Disallow: /wp-content/plugins/
@Willem-Siebe
Willem-Siebe / functions.php
Last active August 29, 2015 14:00
Don't load the WPML Language selector CSS. See http://wpml.org/forums/topic/language-selector-cssv3-1-4/.
// Don't load the WPML Language selector CSS, see https://gist.github.com/Willem-Siebe/751d2a2a9cedf6036256.
define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
// Remove WooCommerce breadcrumbs, see https://gist.github.com/Willem-Siebe/65d59638d503682fa67a.
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
@Willem-Siebe
Willem-Siebe / functions.php
Last active August 29, 2015 14:01
Integrate WooCommerce in your custom theme, see http://docs.woothemes.com/document/third-party-custom-theme-compatibility/. Be aware that if your parent theme uses "woocommerce.php" to remove or rename this file (this change will be lost when updating the theme).
// WooCommerce theme integration, see https://gist.github.com/Willem-Siebe/9cd10326c07f5e3e8076.
/**
* woocommerce_before_main_content hook
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );
function custom_woocommerce_billing_fields( $fields ) {
// Over-ride a single label
$fields['billing_first_name']['label'] = 'Your label';
// Over-ride a single required value
$fields['billing_first_name']['required'] = false;
@Willem-Siebe
Willem-Siebe / gist:2f2f64012b9cfe36df1a
Created May 25, 2014 15:20
Change the UL for WooCommerce product loop start and end if your are not using a list, but for example Twitter Bootstrap. There are two other ways of doing this, overwriting the WooCommerce template files or using your own templates files. See https://github.com/woothemes/woocommerce/issues/5197.
// Change the UL for WooCommerce product loop start and end if your are not using a list, but for example Twitter Bootstrap. See https://gist.github.com/Willem-Siebe/2f2f64012b9cfe36df1a.
function woocommerce_product_loop_start() {
echo '<div class="wsis-wc-product-loop">';
}
function woocommerce_product_loop_end() {
echo '</div>';
}
@Willem-Siebe
Willem-Siebe / functions.php
Created May 27, 2014 06:30
Register LESS stylesheet using the WP LESS plugin, download it here: http://wordpress.org/plugins/wp-less/. Register stylesheet(s) explained here: https://github.com/oncletom/wp-less/wiki/Common-Usage#Registering%20a%20LESS%20stylesheet.
// Register LESS stylesheet using the WP LESS plugin, see https://gist.github.com/Willem-Siebe/e7800869c3517d85614c.
function wsis_enqueue_styles() {
wp_enqueue_style('style-less', get_stylesheet_directory_uri().'/less/style.less');
}
add_action('wp_enqueue_scripts', 'wsis_enqueue_styles');
@Willem-Siebe
Willem-Siebe / style.less
Last active August 29, 2015 14:01
Add Font Awesome to your LESS stylesheet. My style.less file is placed inside a folder called 'less', the paths used below are relative from this directory. See http://fortawesome.github.io/Font-Awesome/3.2.1/get-started/, although I use a slightly different approach which is more update safe. First create your 'font-awesome' folder in your chil…
// Add Font Awesome to your LESS stylesheet, see https://gist.github.com/Willem-Siebe/dc6c94aa7dd17c54e9fd.
@import "../font-awesome/less/font-awesome.less";
@import "font-awesome/variables.less";
@Willem-Siebe
Willem-Siebe / variables.less
Last active August 29, 2015 14:01
Overwriting @FontAwesomePath using our own variables.less. You need to do this first: https://gist.github.com/Willem-Siebe/dc6c94aa7dd17c54e9fd.
// Variables
// --------------------------
// Overwriting @FontAwesomePath using our own variables.less, see https://gist.github.com/Willem-Siebe/e9eeca9db432e1a9ab50.
@FontAwesomePath: "../font-awesome/font/";