Skip to content

Instantly share code, notes, and snippets.

View weartstudio's full-sized avatar

Balazs Egyed weartstudio

View GitHub Profile
@weartstudio
weartstudio / docker-compose.yaml
Created December 16, 2021 18:49
Docker WordPress setup for Apple M1 SiIicon
version: '3'
services:
# Database
db:
platform: linux/x86_64
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
@weartstudio
weartstudio / functions.php
Created December 17, 2020 12:32
Variable products tax display - enabled suffix
add_filter('woocommerce_get_price_suffix', function ( $html, $product, $price, $qty ) {
if ( ! $html && $product instanceof WC_Product_Variable) {
// Copied from plugins/woocommerce/includes/abstracts/abstract-wc-product.php#get_price_suffix
if ( ( $suffix = get_option( 'woocommerce_price_display_suffix' ) )
&& wc_tax_enabled()
&& 'taxable' === $product->get_tax_status()
) {
$replacements = array(
'{price_including_tax}' => wc_price( wc_get_price_including_tax( $product, array( 'qty' => $qty, 'price' => $price ) ) ),
'{price_excluding_tax}' => wc_price( wc_get_price_excluding_tax( $product, array( 'qty' => $qty, 'price' => $price ) ) ),
@weartstudio
weartstudio / raktar_allapotok.php
Last active December 21, 2020 12:04
WooCommerce Warehouse Status
<?php
// paste into the 'functions.php'
// author: weart.hu
// New Statuses
function weart_filter_stock_status_options( $status ) {
// Add new statuses
$status['raktar_2_3'] = __( 'Raktáron, kiszállítás 2-3 munkanap', 'woocommerce' );
$status['raktar_4_5'] = __( 'Raktáron, kiszállítás 4-5 munkanap', 'woocommerce' );
$status['kulso_raktar_4_5'] = __( 'Külső raktáron, kiszállítás 4-5 munkanap', 'woocommerce' );
@weartstudio
weartstudio / .gitignore
Created June 26, 2019 11:40
Gitignore Sass Cache files
assets/.sass-cache/*
assets/.sass-cache
.sass-cache/
*.css.map
@weartstudio
weartstudio / index.js
Created January 30, 2018 16:30
Live Reload JS, CSS and any Others when it changes.
/* This solution is for html frontend development.
1.) Install Node https://nodejs.org/en/
2.) In a commander or dash or anything like this type this after you find the working folder with 'cd':
npm install -g live-server
3.) Than you just start the server, type:
live-server
*/
@weartstudio
weartstudio / infinite-masonry.js
Last active November 9, 2017 10:46
JS - Masonry and old infinite scroll
var $container = $('#container');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.box',
columnWidth: 100
});
});
$container.infinitescroll({
@weartstudio
weartstudio / sanitize.php
Last active September 10, 2022 08:55
WordPress: Sanitize elements for WP Customizr. Sanitize functions. Image upload, adsense box, checkbox, text, select
<?php
//sanitize adsense box adsense codes
function weart_sanitize_adsense( $input ) {
esc_js($input);
$input = str_replace(array("\r", "\n"), '', $input);
return $input;
}
//sanitize checkbox
@weartstudio
weartstudio / transition_mixin.scss
Created October 1, 2017 15:57
CSS3, SASS: Nice transition for links
//the mixin
@mixin transition(){
-o-transition: all 0.15s ease-in-out;
-webkit-transition: all 0.15s ease-in-out;
-moz-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
}
//the usage
a{
@weartstudio
weartstudio / home_is_paged.php
Created October 1, 2017 14:33
WordPress: Hide content from home if paged.
<?php if( is_home() && !is_paged() ) : ?>
<!-- The content what do you want to hide. -->
<?php endif; ?>
@weartstudio
weartstudio / featured_posts.php
Last active October 1, 2017 14:37
WordPress: Display different styled featured posts without WP_Query.