Skip to content

Instantly share code, notes, and snippets.

View ncyhere's full-sized avatar
👋
Hello

ncyhere

👋
Hello
View GitHub Profile
@ncyhere
ncyhere / wordpress-login-logo.php
Created October 9, 2019 10:16
Change WordPress Login logo
<?php
function ncydesign_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url(https://ncy.local/wp-content/uploads/2019/10/letter-n.png) !important; }
</style>';
}
add_action('login_head', 'ncydesign_custom_login_logo');
?>
@ncyhere
ncyhere / user-gold-member.php
Created October 6, 2019 03:56
Gold member user role
<?php
$result = add_role(
'basic_reader',
__( 'Basic Reader' ),
array(
'$role = get_role( 'basic_reader' ),
$role->add_cap( 'install_plugins' ),
$role = get_role( 'basic_reader' ),
@ncyhere
ncyhere / gold-member.php
Last active October 6, 2019 03:48
Create a Gold Member user role
<?php
/**
* @snippet Create a New User Role
* @author Ncy Design https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
$result = add_role(
'gold_member',
__( 'Gold Member' ),
array(
@ncyhere
ncyhere / user-role.php
Created October 6, 2019 03:42
Create a new user role
variable = add_role( ‘$role’, __( ‘$display_name’ ), array($capabilities));
@ncyhere
ncyhere / woo-delivery-date-picker.php
Last active May 23, 2022 00:47
Woocommerce delivery date Picker
/**
* @snippet WooCommerce Checkout date picker
* @author NCY Design https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
// Register main datepicker jQuery plugin script
add_action( 'wp_enqueue_scripts', 'enabling_date_picker' );
function enabling_date_picker() {
// Only on front-end and checkout page
/**
* @snippet Shipping Phone in WooCommerce Checkout
* @author Ncy Design https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
add_filter( 'woocommerce_checkout_fields', 'ncydesign_shipping_phone_checkout' );
function ncydesign_shipping_phone_checkout( $fields ) {
$fields['shipping']['shipping_phone'] = array(
@ncyhere
ncyhere / Woo-remove-order-notes.php
Last active October 3, 2019 07:55
Remove Order notes from WooCommerce Checkout Page
/**
* @snippet Remove Order notes from WooCommerce Checkout Page
* @author NCY DESIGN https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
add_filter( 'woocommerce_checkout_fields' , 'ncydesign_remove_ordernotes' );
function ncydesign_remove_ordernotes( $fields ) {
unset($fields['order']['order_comments']);
@ncyhere
ncyhere / woo-remove-shipping-fields.php
Last active October 3, 2019 08:04
Remove shipping fields
//Remove shipping Fields
unset($fields['shipping']['shipping_first_name']); //shipping First Name
unset($fields['shipping']['shipping_last_name']); //shipping Last Name
unset($fields['shipping']['shipping_company']); //shipping Company
unset($fields['shipping']['shipping_address_1']); // shipping Address 1
@ncyhere
ncyhere / woo-remove-fields.php
Last active October 3, 2019 08:02
Remove billing Fields
//Remove Billing Fields
unset($fields['billing']['billing_first_name']); //Billing First Name
unset($fields['billing']['billing_last_name']); //Billing Last Name
unset($fields['billing']['billing_company']); //Billing Company
unset($fields['billing']['billing_address_1']); // Billing Address 1
@ncyhere
ncyhere / woo-remove-company-billing.php
Last active October 3, 2019 07:57
Remove Company Input Field from WooCommerce Checkout
/**
* @snippet Remove Company Input field from WooCommerce Checkout Page
* @author NCY DESIGN https://wordpress.ncy.design
* @compatible WooCommerce 3.7.0
*/
add_filter( 'woocommerce_checkout_fields' , 'ncydesign_remove_woocommerce_checkout_fields' );
function ncydesign_remove_woocommerce_checkout_fields( $fields ) {