Skip to content

Instantly share code, notes, and snippets.

View rynaldos-zz's full-sized avatar

Rynaldo rynaldos-zz

View GitHub Profile
@rynaldos-zz
rynaldos-zz / pricerunner_code.php
Created May 17, 2016 10:46
Thankyou Page (Pricerunner code)
add_action( 'woocommerce_thankyou', 'my_custom_code' );
function my_custom_code() {
?>
<!-- My Custom Code -->
<script src ="https://research.pricerunner.com/cgi-bin/quest/cssi.js?quest=102&client=CID"></script><a href="#" onclick="launchCSS()">Skriv in den text ni vill visa för länken här</a>
<?php
}
@rynaldos-zz
rynaldos-zz / no-sidebar-shop.php
Created May 19, 2016 11:21
Remove sidebar from shop page (Storefront)
/* Remove Sidebar from Shop Page */
add_action( 'get_header', 'remove_storefront_sidebar' );
function remove_storefront_sidebar() {
if ( is_shop() ) {
remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
}
}
@rynaldos-zz
rynaldos-zz / wc-google-store-badge.php
Last active February 3, 2017 08:24
[WooCommerce] Adds the Google store badge
add_action( 'woocommerce_google_badge', 'my_google_badge' );
function my_google_badge() {
?>
<!-- BEGIN: Google Trusted Store -->
<script type="text/javascript">
var gts = gts || [];
@rynaldos-zz
rynaldos-zz / wc-unset-prod-data-tabs.php
Last active February 3, 2017 08:23
[WooCommerce] Unsetting product data tabs in backend
// uncomment the tabs you don't want hidden
function remove_tab($tabs){
unset($tabs['shipping']); // it is to remove shipping tab
unset($tabs['inventory']); // it is to remove inventory tab
unset($tabs['advanced']); // it is to remove advanced tab
unset($tabs['linked_product']); // it is to remove linked_product tab
unset($tabs['attribute']); // it is to remove attribute tab
unset($tabs['variations']); // it is to remove variations tab
return($tabs);
}
@rynaldos-zz
rynaldos-zz / wc-sold-label-on-archive-pages.php
Last active March 23, 2021 17:50
[WooCommerce] Display 'SOLD' label on product archive pages (out of stock items)
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_stock', 10 );
function woocommerce_template_loop_stock() {
global $product;
if ( ! $product->managing_stock() && ! $product->is_in_stock() )
echo '<p class="stock out-of-stock">SOLD</p>';
}
@rynaldos-zz
rynaldos-zz / wc-replace-search-placeholder.php
Last active February 3, 2017 08:17
[WooCommerce] Replace the default (WC) search widget placeholder
add_filter( 'get_product_search_form' , 'woo_custom_product_searchform' );
function woo_custom_product_searchform( $form ) {
$form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '">
<div>
<label class="screen-reader-text" for="s">' . __( 'Search for:', 'woocommerce' ) . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Zoek opleidingen', 'woocommerce' ) . '" />
<input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search', 'woocommerce' ) .'" />
<input type="hidden" name="post_type" value="product" />
@rynaldos-zz
rynaldos-zz / wc-ps-labels.php
Last active February 3, 2017 08:16
[WordPress | WooCommerce] Change password strength meter labels
// WordPress
add_action( 'wp_enqueue_scripts', 'my_strength_meter_localize_script' );
function my_strength_meter_localize_script() {
wp_localize_script( 'password-strength-meter', 'pwsL10n', array(
'empty' => __( 'But... it\'s empty!', 'theme-domain' ),
'short' => __( 'Too short!', 'theme-domain' ),
'bad' => __( 'Not even close!', 'theme-domain' ),
'good' => __( 'You are getting closer...', 'theme-domain' ),
'strong' => __( 'Now, that\'s a password!', 'theme-domain' ),
@rynaldos-zz
rynaldos-zz / wc-no-state-field-required.php
Last active February 3, 2017 08:12
[WooCommerce] Make the State field not required
add_filter( 'woocommerce_billing_fields', 'woo_filter_state_billing', 10, 1 );
add_filter( 'woocommerce_shipping_fields', 'woo_filter_state_shipping', 10, 1 );
function woo_filter_state_billing( $address_fields ) {
$address_fields['billing_state']['required'] = false;
return $address_fields;
}
function woo_filter_state_shipping( $address_fields ) {
$address_fields['shipping_state']['required'] = false;
return $address_fields;
}
@rynaldos-zz
rynaldos-zz / disable_pass-strength.php
Created July 21, 2016 19:01
Password Strength Disable
function wc_ninja_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
@rynaldos-zz
rynaldos-zz / hide-trs-string.php
Created July 22, 2016 10:24
Hide TRS String in Cart / Checkout
.cart_totals tr.shipping td,
#order_review tr.shipping td {
visibility: hidden;
float: left;
}
.cart_totals tr.shipping td span.amount,
#order_review tr.shipping td span.amount {
visibility: visible;
float: left;