Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Chetan Satasiya chetansatasiya

🏠
Working from home
Block or report user

Report or block chetansatasiya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chetansatasiya
chetansatasiya / functions.php
Created Sep 9, 2019
Add Custom Notification
View functions.php
function custom_filter_notifications_get_registered_components( $component_names = array() ) {
// Force $component_names to be an array
if ( ! is_array( $component_names ) ) {
$component_names = array();
}
// Add 'insert_post_comment' component to registered components array
array_push( $component_names, 'insert_post_comment' );
View vvv.log
C:\vagrant-local>vagrant up
__ __ __ __
\ V\ V\ V / Varying Vagrant Vagrants
\_/\_/\_/ v2.2.1-git::master
Docs: https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
Dashboard: http://vvv.test
Bringing machine 'default' up with 'virtualbox' provider...
@chetansatasiya
chetansatasiya / functions.php
Created Apr 10, 2018
Convert one timezone to another timezone
View functions.php
<?php
function convert_time_one_timezone_to_other_timezone( $current_timezone = '', $time = '', $convert_to_timezone = 'EST' ) {
$utc_date = DateTime::createFromFormat(
'G:i',
"$time",
new DateTimeZone("$current_timezone")
);
View functions.php
<?php
function cs_wcmenucart($menu, $args) {
global $woocommerce;
$viewing_cart = __('View your shopping cart', 'your-theme-slug');
$start_shopping = __('Start shopping', 'your-theme-slug');
$cart_url = $woocommerce->cart->get_cart_url();
$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
$cart_contents_count = $woocommerce->cart->cart_contents_count;
@chetansatasiya
chetansatasiya / functions.php
Created Feb 9, 2018
Disable the WooCommerce 3.+ default lightbox
View functions.php
<?php
add_action( 'after_setup_theme', 'cs_remove_woo_gallery_lightbox', 100 );
function cs_remove_woo_gallery_lightbox() {
remove_theme_support( 'wc-product-gallery-lightbox' );
}
@chetansatasiya
chetansatasiya / functions.php
Created Feb 9, 2018
Woocommerce add coupon code in new order admin email
View functions.php
<?php
add_filter('woocommerce_get_order_item_totals','cs_add_discount',10,3);
function cs_add_discount($total_rows, $order, $tax_display) {
if ( $order->get_total_discount() > 0 ) {
$coupons = $order->get_used_coupons();
$total_rows['couponused'] = array(
'label' => __( 'Coupon code:', 'woocommerce' ),
'value' => '' . implode(",",$coupons), );
}
@chetansatasiya
chetansatasiya / functions.php
Last active Oct 30, 2017
Fetch remote URL image and set to featured image in given postid in WordPress
View functions.php
<?php
function set_featured_image($url,$post_id) {
$attachment_id = media_sideload_image( $url, $post_id, '', 'id' );
if ( ! is_wp_error( $attachment_id ) ) {
set_post_thumbnail( $post_id, $attachment_id );
}
}
@chetansatasiya
chetansatasiya / functions.php
Created Jun 19, 2017
How to Change the Login Logo URL in WordPress
View functions.php
<?php
add_filter( 'login_headerurl', 'custom_loginlogo_url' );
function custom_loginlogo_url($url) {
return 'http://www.wordpress.com';
}
@chetansatasiya
chetansatasiya / functions.php
Created Jun 19, 2017
How to Change the Login Logo in WordPress
View functions.php
<?php
function custom_loginlogo() {
echo '<style type="text/css">h1 a {background-image: url('.get_bloginfo('template_directory').'/images/login_logo.png) !important; }
</style>';
}
add_action('login_head', 'custom_loginlogo');
@chetansatasiya
chetansatasiya / xampp_php7_xdebug.md
Last active Jun 19, 2017
Install Xdebug for XAMPP
View xampp_php7_xdebug.md
You can’t perform that action at this time.