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
[ | |
{ | |
"name": "theme_info", | |
"logo": "https:\/\/cdn.shopify.com\/s\/global\/branding\/shopify_logo_256x256.png", | |
"settings": [ | |
{ | |
"type": "header", | |
"content": "Theme 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
{% comment %} | |
Example of AdWords Purchase conversion tracking code. | |
Make sure you've already got global AdWords tag installed on the site. | |
{% endcomment %} | |
{% if first_time_accessed %} | |
<!-- Event snippet for Purchase CH conversion page --> | |
<script> | |
gtag('event', 'conversion', { |
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
# WP Multisite htaccess file for Apache | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
# add a trailing slash to /wp-admin | |
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] | |
RewriteCond %{REQUEST_FILENAME} -f [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^ - [L] | |
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [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
<?php | |
$rootPath = realpath('folder'); | |
$zip = new ZipArchive(); | |
$zip->open('archive.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE); | |
$files = new RecursiveIteratorIterator( | |
new RecursiveDirectoryIterator($rootPath), | |
RecursiveIteratorIterator::LEAVES_ONLY | |
); |
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 | |
/** | |
* Template ajax callback | |
*/ | |
add_action( 'wp_ajax_callback', 'callback' ); | |
add_action( 'wp_ajax_nopriv_callback', 'callback' ); | |
function callback($a) { | |
$data = dosomething($a); |
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 coupon automatically: disabled | |
*/ | |
add_action('woocommerce_before_checkout_form', 'preorder_coupon'); | |
function preorder_coupon() { | |
if ( in_array( 'discount', WC()->cart->get_applied_coupons() ) ) { | |
return; | |
} else { | |
WC()->cart->apply_coupon('discount'); |
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_filter( 'gettext', 'change_woocommerce_return_to_shop_text', 20, 3 ); | |
function change_woocommerce_return_to_shop_text( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Return to cart' : | |
$translated_text = __( 'Back to Shop', 'woocommerce' ); | |
case 'Return to basket' : | |
$translated_text = __( 'Back to Shop', 'woocommerce' ); | |
break; | |
} | |
return $translated_text; |
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( 'wp_footer', 'woo_prevent_submit_on_keypress' ); | |
function woo_prevent_submit_on_keypress() { | |
ob_start();?> | |
<script> | |
jQuery(function($){ | |
$('form.woocommerce-checkout input').keydown(function (e) { | |
if (e. keyCode == 13) { | |
e.preventDefault(); |
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( 'wp_footer','woo_checkout_prevent_scroll_to_notices' ); | |
function woo_checkout_prevent_scroll_to_notices() { | |
if ( function_exists( 'is_checkout' ) && is_checkout() ) : | |
ob_start();?> | |
<script> | |
jQuery( function($) { | |
$( document ).ajaxComplete( function() { // prevents woocommerce checkout.js scroll to notices on ajax update |
OlderNewer