Skip to content

Instantly share code, notes, and snippets.

@diekaines
diekaines / filter.txt
Created February 24, 2022 01:59 — forked from chocolatkey/filter.txt
Bypass Komiflo region detection (add to ublock origin filter)
||region-test.komiflo.com/region-test.gif$image,redirect=1x1-transparent.gif,domain=komiflo.com
@diekaines
diekaines / functions.php
Created November 23, 2017 23:34 — forked from AustinGil/functions.php
AJAX load more posts
function assets() {
// enqueue your script
wp_enqueue_script('handle', get_template_directory_uri() . '/path/to/main.js', ['jquery'], '$ver', true);
// localize script
wp_localize_script('handle', 'custom_ajaxify', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
}
add_action('wp_enqueue_scripts', 'assets', 100);
/**
* AJAX load template part
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<script>
var ajaxurl = '<?php echo site_url() ?>/wp-admin/admin-ajax.php';
var true_posts = '<?php echo serialize($wp_query->query_vars); ?>';
var current_page = <?php echo (get_query_var('paged')) ? get_query_var('paged') : 1; ?>;
var max_pages = '<?php echo $wp_query->max_num_pages; ?>';
</script>
<div id="true_loadmore" class="btn">Load more</div>
<?php endif; ?>
@diekaines
diekaines / gettext-filter-multiple.php
Created March 25, 2017 09:59 — forked from BFTrick/gettext-filter-multiple.php
Use the gettext WordPress filter to change any translatable string.
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Sale!' :
$translated_text = __( 'Clearance!', 'woocommerce' );
@diekaines
diekaines / gist:d4b9d924b519ab08f52e
Created February 23, 2016 08:49 — forked from bbirdme/woocommerce_by_tags.php
List WooCommerce products by tags
<?php
/**
* Plugin Name: WooCommerce - List Products by Tags
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-tags/
* Description: List WooCommerce products by tags using a shortcode, ex: [woo_products_by_tags tags="shoes,socks"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
/**
*
* Filter gateways on specific category ID
*
**/
function filter_gateways($gateways){
// Add Cart to Checkout //
add_action( 'woocommerce_before_checkout_form', 'lk_show_cart', 5 );
function lk_show_cart()
{
global $woocommerce;
?>
<form action="<?php echo esc_url( $woocommerce->cart->get_cart_url() ); ?>" method="post">
function lk_aussie_gateways( $available_gateways ) {
global $woocommerce;
if ($woocommerce->customer->get_country() == 'AU') {
unset( $available_gateways['cod'] );
}
return $available_gateways;
add_filter( 'comments_template', 'USEGENERIC_woocommerce_comments', 100);
function USEGENERIC_woocommerce_comments( $template ) {
$template = STYLESHEETPATH . '/comments.php';
return $template;
}
add_filter('woocommerce_billing_fields', 'custom_woocommerce_billing_fields');
function custom_woocommerce_billing_fields( $fields ) {
$fields['billing_address_1']['class'] = array( 'form-group' );
$fields['billing_address_1']['input_class'] = array( 'form-control' );
return $fields;
}