Skip to content

Instantly share code, notes, and snippets.

View Willem-Siebe's full-sized avatar

Willem-Siebe

View GitHub Profile
@Willem-Siebe
Willem-Siebe / gist:c323a9d71597d7128f24
Created January 7, 2015 13:44
Remove CSS from WooCommerce Dynamic Pricing & Discounts plugin, plugin link"http://codecanyon.net/item/woocommerce-dynamic-pricing-discounts/7119279.
// Remove CSS from WooCommerce Dynamic Pricing & Discounts plugin, see https://gist.github.com/Willem-Siebe/c323a9d71597d7128f24.
function wsis_remove_woocommerce_dynamic_pricing_discounts_assets() {
wp_dequeue_style('rp-wcdpd-frontend-styles');
}
add_action('wp_enqueue_scripts','wsis_remove_woocommerce_dynamic_pricing_discounts_assets',999);
@Willem-Siebe
Willem-Siebe / functions.php
Last active October 23, 2015 15:13
Assign user to other role then in used in settings of Formdable Registration plugin, see https://formidablepro.com/help-desk/formidable-registration-give-user-other-role-by-choosing-for-checkbox/
// Assign user to other role then in used in settings of Formdable Registration plugin, see https://gist.github.com/Willem-Siebe/a14c4ec86eddd7073f67.
function frmreg_new_role($user_role, $atts){
extract($atts);
if($form->id == 7){ // WSIS: change this to your form ID
if($_POST['item_meta'][103] == 'professional') //change 125 to the ID of your field and 'Author' to the value of your radio button WSIS: or single checkbox
$user_role = 'ignite_level_5367f4bc4171a'; // WSIS: rolename
}
return $user_role;
}
@Willem-Siebe
Willem-Siebe / gist:037d1d5d8b6ec2d92db9
Last active August 29, 2015 14:10
Remove table (frontend) CSS from WooCommerce Dynamic Discounts & Pricing plugin, see http://codecanyon.net/item/woocommerce-dynamic-pricing-discounts/7119279.
// Remove table CSS from WooCommerce Dynamic Discounts & Pricing plugin, see https://gist.github.com/Willem-Siebe/037d1d5d8b6ec2d92db9
function wsis_remove_wcdpd_assets() {
wp_dequeue_style('rp-wcdpd-frontend-styles');
}
add_action('wp_enqueue_scripts','wsis_remove_wcdpd_assets',999);
@Willem-Siebe
Willem-Siebe / wp-config.php
Last active August 29, 2015 14:07
Change upload location media folder WordPress
/** Change upload location media folder WordPress, see https://gist.github.com/ff6fb2a82e2ed3e788e4.git. */
define( 'UPLOADS', ''.'media' );
// Remove CSS and JS from Jetpack plugin, see https://gist.github.com/Willem-Siebe/3f6bff80b01973a21467.
function wsis_remove_jetpack_assets() {
// devicepx-jetpack.js, used to optionally load retina/HiDPI versions of files (Gravatars etc) which are known to support it, for devices that run at a higher resolution.
wp_dequeue_script( 'devicepx' );
}
add_action( 'wp_enqueue_scripts', 'wsis_remove_jetpack_assets', 20 );
// Remove CSS and JS from Views plugin, only when it's not needed! See https://gist.github.com/Willem-Siebe/9520464d0b6b763bf1de.
add_action('wp_enqueue_scripts', 'wsis_prefix_remove_views_assets', 20);
function wsis_prefix_remove_views_assets() {
// Scripts
// views_front_end_utils.js (not used anymore from -for sure- version 1.6.4)
// used in Views parametric searches
@Willem-Siebe
Willem-Siebe / gist:7be8c630c3052f50d895
Last active August 29, 2015 14:04
Overwrite JS of WooCommerce [NOT WORKING] - I copied exact same JS to my own file but it is not working. See: http://stackoverflow.com/a/22648605. Also the approved answer method doesn't work. Dequeque is working, enqueqe not.
// js wijzigen bekijk winkelwagen
add_action( 'wp_enqueue_scripts', 'wsis_remove_woocommerce_add_to_cart_js' );
function wsis_remove_woocommerce_add_to_cart_js() {
wp_dequeue_script('wc-add-to-cart');
}
add_action( 'wp_enqueue_scripts', 'wsis_add_changed_woocommerce_add_to_cart_js', 9 );
// Change sidebar widget values 'before' and 'after', see https://gist.github.com/Willem-Siebe/90654e8fdf5513c13771.
function wsis_modify_before_widget_after_widget($params) {
if ($params[0]['id']=='header-widgets-search') {
if (strpos($params[0]['before_widget'],'nav_menu-14')) {
//Supposing you want to change the HTML to <ul> instead of <div>
@Willem-Siebe
Willem-Siebe / functions.php
Last active September 7, 2020 10:56
Replace the 'x' in WooCommerce cart.php with text because 'x' is not helpfull at all for screenreader users. I give a extra class to the text so that it can be hidden with CSS for visual browsers, because I replace that link with Font Awesome icon using :before. See also: https://github.com/woothemes/woocommerce/issues/5725.
// Replace the 'x' in WooCommerce cart.php with text because 'x' is not helpfull at all for screenreader users, see https://gist.github.com/Willem-Siebe/dc34719917e77fcecbc6.
function wsis_woocommerce_remove_item( $wsis_html, $cart_item_key ) {
$cart_item_key = $cart_item_key;
$wsis_html = sprintf( '<a href="%s" class="remove" title="%s"><span class="wsis-remove-item">%s</span></a>', esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ), __( 'Remove this item', 'woocommerce' ));
return $wsis_html;
}
add_filter ( 'woocommerce_cart_item_remove_link', 'wsis_woocommerce_remove_item', 10, 2 );
@Willem-Siebe
Willem-Siebe / functions.php
Last active July 9, 2017 13:36
Display WooCommerce shop, category and tag description also on next pages. I can only changing it by declaring the same function name in my own functions.php, so that is what I did.
// Display WooCommerce shop, category and tag description also on next pages, see https://gist.github.com/Willem-Siebe/c883eeb2eefb5eea82ab.
function woocommerce_product_archive_description() {
if ( is_post_type_archive( 'product' ) && get_query_var( 'paged' ) >= 0 ) {
$shop_page = get_post( wc_get_page_id( 'shop' ) );
if ( $shop_page ) {
$description = apply_filters( 'the_content', $shop_page->post_content );
if ( $description ) {
echo '<div class="page-description">' . $description . '</div>';
}