Skip to content

Instantly share code, notes, and snippets.

View mikeyarce's full-sized avatar

Mikey Arce mikeyarce

View GitHub Profile
@mikeyarce
mikeyarce / functions.php
Created January 27, 2016 16:10 — forked from WPprodigy/functions.php
Remove the password strength meter from WooCommerce checkout
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 );
@mikeyarce
mikeyarce / customize_class_id.php
Last active February 19, 2016 17:18
Variations and Colour Swatches custom class or ID
// change output $args in variation swatches
function change_class_or_id( $args ) {
$args = array(
'options' => false,
'attribute' => false,
'product' => false,
'selected' => false,
'name' => '',
'id' => 'testyyy',
'class' => 'test',
@mikeyarce
mikeyarce / memberships-shortcode.php
Created March 22, 2016 18:16
Memberships Shortcode
/**
* Creates a shortcode to output the "My Memberships" table anywhere on the site
* Outputs this section only if the current user has 1 or more memberships
*
* Use the shortcode: [wcm_my_memberships]
*/
function sv_wc_memberships_my_memberships_shortcode() {
// buffer contents
ob_start();
@mikeyarce
mikeyarce / marce_remove_sale_dynamic_pricing.php
Last active December 16, 2016 03:10
Remove Sale price from products when using Dynamic Pricing
<?php
// Remove the <?php tag above if your file already includes it
// Remove Sale price from products when using Dynamic Pricing
function marce_remove_sale_dynamic_pricing() {
$WC_Dynamic_Pricing = WC_Dynamic_Pricing::instance();
remove_filter( 'woocommerce_product_is_on_sale', array( $WC_Dynamic_Pricing, 'on_get_product_is_on_sale'), 10, 2 );
}
add_action( 'plugins_loaded', 'marce_remove_sale_dynamic_pricing');
@mikeyarce
mikeyarce / header-hook-sider.php
Last active April 15, 2016 15:40
Add a full-width slider before the main content for the front page in Canvas
// Add Slider conditionally to the header only for the front page
add_action ( 'woo_content_before', 'marce_front_page_slider' );
function marce_front_page_slider() {
if ( is_front_page() ) {
echo do_shortcode( '[wooslider slider_type="slides" thumbnails="default" order="DESC" order_by="date"]' );
}
}
@mikeyarce
mikeyarce / storefront_custom_logo_size.php
Last active May 27, 2016 18:39
Change the default custom logo size for Storefront and it's child themes
<?php
// Add this to your theme's functions.php
function marce_change_custom_logo_size() {
add_theme_support( 'custom-logo', array(
'height' => 400,
'width' => 400,
'flex-width' => true,
) );
}
@mikeyarce
mikeyarce / memberships-restrict.php
Last active June 7, 2016 17:50
Restrict WooCommerce Membership in template
<?php
$user_id = get_current_user_id();
if ( wc_memberships_is_user_active_member( $user_id, 'gold' ) ) {
get_template_part( 'template', 'assessment' );
} else {
echo "You are not allowed to view this content";
}
?>
@media screen and (max-width: 768px) { ul.products li.product .onsale { font-size: 0.8em; } }
<?php
/*STEP 1 - REMOVE ADD TO CART BUTTON ON PRODUCT ARCHIVE (SHOP) */
function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action('init','remove_loop_button');
.post-4579 p.stock.in-stock {
display: none;
}