Skip to content

Instantly share code, notes, and snippets.

View shivapoudel's full-sized avatar
🎯
Focusing

Shiva Poudel shivapoudel

🎯
Focusing
View GitHub Profile
@shivapoudel
shivapoudel / functions.php
Last active January 18, 2018 10:33
WooCommerce - Automatically add product to cart on visit
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
if ( class_exists( 'WooCommerce' ) ) {
add_action( 'template_redirect', 'wc_auto_add_product_to_cart' );
}
/**
@shivapoudel
shivapoudel / functions.php
Created December 17, 2016 17:26
WooCommerce - Allow rendering of checkout and account pages in iframes
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'after_setup_theme', 'wc_remove_frame_options_header', 11 );
/**
* Allow rendering of checkout and account pages in iframes.
*/
@shivapoudel
shivapoudel / woocommerce.md
Last active October 27, 2017 17:34
Transactional and Notificational Emails trigger hooks :)

Order Statuses:

'wc-pending'    => _x( 'Pending payment', 'Order status', 'woocommerce' ),
'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ),
'wc-on-hold'    => _x( 'On hold', 'Order status', 'woocommerce' ),
'wc-completed'  => _x( 'Completed', 'Order status', 'woocommerce' ),
'wc-cancelled'  => _x( 'Cancelled', 'Order status', 'woocommerce' ),
'wc-refunded'   => _x( 'Refunded', 'Order status', 'woocommerce' ), // Excluded
'wc-failed' =&gt; _x( 'Failed', 'Order status', 'woocommerce' ), // Excluded
@shivapoudel
shivapoudel / functions.php
Created January 12, 2018 06:24
WP REST API - Modify API base URL prefix.
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'rest_url_prefix', 'custom_rest_url_prefix' );
/**
* Modify url base from 'wp-json' to 'api' prefix.
*/
@shivapoudel
shivapoudel / functions.php
Created January 17, 2018 09:37
WooCommerce - Enable REST API permissions check
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'woocommerce_rest_check_permissions', '__return_true' );
@shivapoudel
shivapoudel / functions.php
Last active February 24, 2023 05:29
WordPress - Enable Dashicons in Frontend
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
/**
* Enqueue the Dashicons script.
*/
@shivapoudel
shivapoudel / functions.php
Created February 3, 2018 09:14
WooCommerce - Prevent order view link being triggered on row click
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
if ( class_exists( 'WooCommerce' ) ) {
add_action( 'post_class', 'wc_order_post_class', 20, 3 );
}
/**
@shivapoudel
shivapoudel / functions.php
Created April 12, 2018 08:37
WooCommerce - Remove all filters for formatted order total
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'plugins_loaded', 'remove_wc_get_formatted_order_total_filters' );
/**
* Remove all filters for WC formatted order total.
*/
@shivapoudel
shivapoudel / functions.php
Created April 13, 2018 06:54
WooCommerce - Change order button text strings
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'gettext', 'custom_order_button_strings', 20 );
/**
* Change order button text strings.
*
@shivapoudel
shivapoudel / quotefancy.py
Last active June 19, 2021 13:39
Scraped wallpapers from Quotefancy.com
import shutil
import os
import requests
from bs4 import BeautifulSoup
# URL handlers to scraped.
url_handles = [
'motivational-quotes',
'inspirational-entrepreneurship-quotes',