This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 ); | |
function new_loop_shop_per_page( $cols ) { | |
// $cols contains the current number of products per page based on the value stored on Options -> Reading | |
// Return the number of products you wanna show per page. | |
$cols = 12; | |
return $cols; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'loop_shop_columns', 'wc_loop_shop_columns', 1, 10 ); | |
/* | |
* Return a new number of maximum columns for shop archives | |
* @param int Original value | |
* @return int New number of columns | |
*/ | |
function wc_loop_shop_columns( $number_columns ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Sign a private asset url on cloudfront | |
* | |
* @param $resource full url of the resources | |
* @param $timeout timeout in seconds | |
* @return string signed url | |
* @throws Exception | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.9-osx10.10-x86_64.tar.gz | |
tar xfvz mysql-5.7* | |
echo "stopping mamp" | |
sudo /Applications/MAMP/bin/stop.sh | |
sudo killall httpd mysqld | |
echo "creating backup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Acme; | |
/** | |
* Class FooBar | |
* | |
* @link http://anomaly.is/foo-bar | |
* @author AnomalyLabs, Inc. <[email protected]> | |
* @author Ryan Thompson <[email protected]> | |
* @package Acme | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.row { | |
max-width: none; | |
width: 960px; /* any width you want */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function alter_shipping_methods($available_gateways){ | |
global $woocommerce; | |
$chosen_titles = array(); | |
$available_methods = $woocommerce->shipping->get_packages(); | |
$chosen_rates = ( isset( $woocommerce->session ) ) ? $woocommerce->session->get( 'chosen_shipping_methods' ) : array(); | |
foreach ($available_methods as $method) | |
foreach ($chosen_rates as $chosen) { | |
if( isset( $method['rates'][$chosen] ) ) $chosen_titles[] = $method['rates'][ $chosen ]->label; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the Term List Breadcrumbs | |
* Same as get_the_term_list() but outputs a terms parents as part of the link. | |
* Useful when you have many subcategories all with the same name. | |
*/ | |
function get_the_term_list_breadcrumbs( $id = 0, $taxonomy, $before = '', $sep = '', $after = '', $breadcrumb_sep = ' → ' ) { | |
$terms = get_the_terms( $id, $taxonomy ); | |
if ( is_wp_error( $terms ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Prevent text scaling on rotate for iPad/iPhone */ | |
html { -webkit-text-size-adjust: none; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add wpml-{ICL_LANGUAGE_CODE} class to body tag | |
*/ | |
function wpml_body_class( $classes ) { | |
if ( defined( 'ICL_LANGUAGE_CODE' ) ) | |
$classes[] = 'wpml-' . strtolower( ICL_LANGUAGE_CODE ); | |
return $classes; | |
} | |
add_filter( 'body_class', 'wpml_body_class' ); |