This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Save the image on the server. | |
*/ | |
function save_image( $base64_img, $title ) { | |
// Upload dir. | |
$upload_dir = wp_upload_dir(); | |
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Custom registration form for WooCommerce | |
function custom_woocommerce_register_form() { | |
$user_role = ( ! empty( $_POST['user_role'] ) ) ? sanitize_text_field( $_POST['user_role'] ) : ''; | |
$company_id = ( ! empty( $_POST['company_id'] ) ) ? sanitize_text_field( $_POST['company_id'] ) : ''; | |
?> | |
<p class="form-row form-row-wide"> | |
<label for="user_role"><?php _e( 'Choose account type', 'woodmart' ); ?></label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'liquid_child_theme_style', 99 ); | |
function liquid_parent_theme_scripts() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
} | |
function liquid_child_theme_style(){ | |
wp_enqueue_style( 'child-hub-style', get_stylesheet_directory_uri() . '/style.css' ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Custom Payment Gateway | |
* Plugin URI: | |
* Description: Woocommerce non_responsible custom payment gateway, for online ordering without online payment systems. | |
* Author: Nick Mkrtchyan | |
* Author URI: https://nickmkrtchyan.github.io/ | |
* Version: 1.1.0 | |
* Text Domain: woo_gateway | |
* Domain Path: /i18n/languages/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
/** | |
* Check if WooCommerce is active | |
**/ | |
function smdfw_is_woocommerce_activated() { | |
return class_exists( 'woocommerce' ); | |
} | |
/** | |
* Init plugin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Woocommerce checkout Fields editor | |
add_filter( 'woocommerce_checkout_fields', 'woo_checkout_field_editor' ); | |
function woo_checkout_field_editor( $fields ) { | |
unset( $fields['billing']['billing_first_name'] ); | |
unset( $fields['billing']['billing_last_name'] ); | |
unset( $fields['billing']['billing_country'] ); | |
unset( $fields['billing']['billing_email'] ); | |
unset( $fields['billing']['billing_phone'] ); | |
// unset( $fields['billing']['billing_company'] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @snippet WooCommerce Role Select During Registration | |
* @how-to https://woohacks.github.io/ | |
* @author Nick Mkrtchyan | |
* @compatible WooCommerce 5.0 | |
*/ | |
function register_role_select_option() { | |
global $wp_roles; ?> | |
<p class="form-row form-row-wide"> | |
<label for="reg_billing_phone"><?php echo __( 'Student or Instructor', 'woocommerce' ) ?></label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @snippet WooCommerce Rename Customer Role Name | |
* @how-to https://woohacks.github.io/ | |
* @author Nick Mkrtchyan | |
* @compatible WooCommerce 5.0 | |
*/ | |
function change_role_name() { | |
global $wp_roles; | |
if ( ! isset( $wp_roles ) ) | |
$wp_roles = new WP_Roles(); |