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 the action setting | |
add_filter( 'wc_points_rewards_action_settings', 'points_rewards_newsletter_action_settings' ); | |
function points_rewards_newsletter_action_settings( $settings ) { | |
$settings[] = array( | |
'title' => __( 'Points earned for newsletter signup' ), | |
'desc_tip' => __( 'Enter the amount of points earned when a customer signs up for a newsletter via MailChimp.' ), |
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
/** | |
* Add theme support for Auto Load Next Post by setting the | |
* theme selectors to be applied once the theme is activated. | |
*/ | |
function add_alnp_theme_support() { | |
add_theme_support( 'auto-load-next-post', array( | |
'content_container' => 'main.site-main', | |
'title_selector' => 'h1.entry-title', | |
'navigation_container' => 'nav.post-navigation', | |
'comments_container' => 'div#comments', |
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 | |
set -e | |
git config --local include.path ../.gitconfig | |
echo "Your local .gitconfig is now setup!" | |
exit 1; |
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
[alias] | |
# Creates a new branch on your local machine and switches into this branch. | |
newbie = "!git checkout -b $(git branch-name)" | |
# Push the current branch to the remote "origin", and set it to track | |
# the upstream branch | |
publish = "!git push -u origin $(git branch-name)" | |
# Delete the remote version of the current branch | |
unpublish = "!git push origin :$(git branch-name)" |
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
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ http://%1/$1 [R=301,L] | |
RewriteCond %{HTTPS} on | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] |
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
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11); | |
function dequeue_woocommerce_cart_fragments() { | |
if ( is_front_page() ) { | |
wp_dequeue_script('wc-cart-fragments'); | |
} | |
} |
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/bash | |
# Installation: | |
# Install the script in one of the folders in your PATH. Make sure it has execute permissions (i.e. chmod +x wp-install-core-sub-dir). | |
#Usage: | |
# $ mkdir mysite | |
# $ cd mysite |
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
<? | |
// <readme> | |
/* | |
This is a lite version of Olark's and Intercom's functionality (without the chat part). | |
It lets you get feedback from users on your site to your email. | |
And you won't have to rely on another company anymore! | |
#killyourdependencies |
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
/** | |
* Returns the shipping cost from the shipping class assigned to the product. | |
* | |
* @param object $product | |
* @return string | |
*/ | |
function get_shipping_cost( $product ) { | |
$shipping_method = apply_filters( 'woocommerce_default_single_product_shipping_method', 'flat_rate' ); | |
$shipping = new WC_Shipping(); |
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_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 ); | |
function wc_product_sold_count() { | |
global $product; | |
$units_sold = get_post_meta( $product->id, 'total_sales', true ); | |
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>'; | |
} | |
?> |