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( 'woocommerce_thankyou', 'send_email_on_coupon_usage' ); | |
| function send_email_on_coupon_usage( $order_id ) { | |
| $order = new WC_Order( $order_id ); | |
| $coupons = $order->get_coupon_codes(); | |
| if( $coupons ) { | |
| foreach( $coupons as $coupon ) { | |
| if( $coupon == '<YOUR_COUPON_CODE>' ) { |
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
| add_action( 'init', 'register_site_custom_posts' ); | |
| // The custom function to register a movie post type | |
| function register_site_custom_posts() { | |
| // Set the labels, this variable is used in the $args array | |
| $labels = array( | |
| 'name' => __( 'Products' ), | |
| 'singular_name' => __( 'Product' ), | |
| 'add_new' => __( 'Add New Product' ), |
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
| { | |
| "name" : "WordPress plugin", | |
| "slug" : "wordpress-plugin/wordpress-plugin", | |
| "author" : "<a href='https://www.author.com'>Author</a>", | |
| "author_profile" : "https://profiles.wordpress.org/author/", | |
| "version" : "1.0.0.", | |
| "download_url" : "https://www.example.com/wordpress-plugin/wordpress-plugin.zip", | |
| "requires" : "3.0", | |
| "tested" : "6.3.1", | |
| "requires_php" : "8.1", |
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
| function order_woo_products_by_slug( $query ) { | |
| if ( ! is_admin() && $query->is_main_query() ) { | |
| // Not a query for an admin page. | |
| // It's the main query for a front end page of your site. | |
| if ( is_woocommerce() || is_tax( 'product_cat' ) ) { | |
| // It's the main query for a WooCommerce category archive or for a WooCommerce page | |
| $query->set( 'orderby', 'name' ); | |
| $query->set( 'order', 'ASC' ); | |
| } |
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
| function bnfw_custom_get_user_ip_address() { | |
| return $_SERVER['REMOTE_ADDR']; | |
| } | |
| add_shortcode( 'custom_user_ip_address', 'bnfw_custom_get_user_ip_address' ); | |
| add_filter( 'wp_mail', function( $args ) { | |
| $args['message'] = do_shortcode( $args['message'] ); | |
| return $args; | |
| }, 1, 1 ); |
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
| /* | |
| * Create a JS file and upload it to your child theme | |
| * Assuming this directory structure: /wp-content/themes/<your_child_theme_folder/assets/js/gform_filters.js | |
| */ | |
| //PHP Side - functions.php or some other way | |
| add_action( 'wp_enqueue_scripts', 'gform_datepicker_options_pre_init_filter' ); | |
| function gform_datepicker_options_pre_init_filter() { | |
| //Add here any required conditionals to load below script conditionally |
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
| //Send request to http(s)://yourdomain.com/wp-json/test/v1/test | |
| class WP_REST { | |
| function __construct() { | |
| add_action( 'rest_api_init', array( $this, 'routes' ) ); | |
| } | |
| function auth_user( $request ) { | |
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
| //Romanian | |
| jQuery.datepicker.regional['ro'] = { | |
| clearText: 'Sterge', clearStatus: '', | |
| closeText: 'Inchide', closeStatus: 'Inchide fara modificari', | |
| prevText: '<Inapoi', prevStatus: 'Vezi luna precedenta', | |
| nextText: 'Inainte>', nextStatus: 'Vezi luna viitoare', | |
| currentText: 'Curenta', currentStatus: 'Vezi luna curenta', | |
| monthNames: ['Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie','Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'], | |
| monthNamesShort: ['Ian','Feb','Mar','Apr','Mai','Iun','Iul','Aug','Sep','Oct','Nov','Dec'], |
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
| add_action('woocommerce_product_options_advanced', function() { | |
| woocommerce_wp_text_input([ | |
| 'id' => '_price_suffix', | |
| 'label' => __( 'Price suffix', 'woocommerce' ), | |
| ]); | |
| }); | |
| add_action('woocommerce_process_product_meta', function($post_id) { | |
| $product = wc_get_product($post_id); | |
| $price_suffix = isset($_POST['_price_suffix']) ? $_POST['_price_suffix'] : ''; |
OlderNewer