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_after_single_product_summary', 'display_on_sale_products_by_brand', 15 ); | |
| function display_on_sale_products_by_brand() { | |
| global $post; | |
| // Get the brands of the current product | |
| $brands = wp_get_post_terms( $post->ID, 'brand' ); | |
| if ( ! empty( $brands ) && ! is_wp_error( $brands ) ) { | |
| foreach ( $brands as $brand ) { |
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 wc_placeholder_img_src( $size = 'woocommerce_thumbnail' ) { | |
| $src = WC()->plugin_url() . '/assets/images/placeholder.png'; | |
| $placeholder_image = get_option( 'woocommerce_placeholder_image', 0 ); | |
| if ( ! empty( $placeholder_image ) ) { | |
| if ( is_numeric( $placeholder_image ) ) { | |
| $image = wp_get_attachment_image_src( $placeholder_image, $size ); | |
| if ( ! empty( $image[0] ) ) { | |
| $src = $image[0]; |
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 display_custom_products_before_category() { | |
| // Define the product IDs you want to display | |
| $custom_product_ids = array(123, 456, 789); // Replace with your product IDs | |
| // Set the date range to display the custom products (for 1 month) | |
| $start_date = '2024-05-01'; // Start date in 'Y-m-d' format | |
| $end_date = '2024-06-01'; // End date in 'Y-m-d' format | |
| $current_date = date('Y-m-d'); | |
| // Check if current date is within the range |
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
| genesis_register_sidebar( array( | |
| 'id' => 'slider', | |
| 'name' => __( 'Slider', 'agentpress' ), | |
| 'description' => __( 'This is the slider widget area.', 'agentpress' ), | |
| ) ); | |
| add_action( 'genesis_before_content_sidebar_wrap', 'slider_before_content', 5 ); | |
| function slider_before_content() { | |
| if ( is_front_page() ) |
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( 'genesis_after_header', 'hook_slider' ); | |
| function hook_slider() { | |
| if ( is_front_page() ) { ?> | |
| <div class="carousel-slider"> | |
| <div class="slide"><img src="http://placehold.it/350x150&text=Slide1"></div> | |
| <div class="slide"><img src="http://placehold.it/350x150&text=Slide2"></div> | |
| <div class="slide"><img src="http://placehold.it/350x150&text=Slide3"></div> | |
| <div class="slide"><img src="http://placehold.it/350x150&text=Slide4"></div> | |
| <div class="slide"><img src="http://placehold.it/350x150&text=Slide5"></div> | |
| <div class="slide"><img src="http://placehold.it/350x150&text=Slide6"></div> |
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_filter('woocommerce_product_add_to_cart_text', 'custom_combined_add_to_cart_button_text', 10, 2); | |
| add_filter('woocommerce_product_single_add_to_cart_text', 'custom_combined_add_to_cart_button_text', 10, 2); | |
| function custom_combined_add_to_cart_button_text($text, $product) { | |
| if ( ! $product->is_in_stock()) { | |
| return __('Out of Stock', 'woocommerce'); | |
| } else { |
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 apply_shipping_based_discounts() { | |
| $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods'); | |
| $chosen_shipping_method = $chosen_shipping_methods[0]; | |
| $discount = 0; | |
| if ($chosen_shipping_method === 'free_shipping') { | |
| $discount = 10; // Discount for free shipping | |
| } elseif ($chosen_shipping_method === 'flat_rate') { | |
| $discount = 5; // Discount for flat rate | |
| } elseif ($chosen_shipping_method === 'local_pickup') { |
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
| // Enqueue Font Awesome | |
| function enqueue_font_awesome() { | |
| wp_enqueue_style( 'font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css' ); | |
| } | |
| add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' ); | |
| // Change "Add to Cart" button text to a shopping cart icon | |
| function custom_add_to_cart_text() { | |
| echo '<i class="fas fa-shopping-cart"></i>'; // Font Awesome shopping cart icon | |
| } |
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
| 'US' => array( | |
| 'default_fee' => 100, | |
| 'over_threshold_fee' => 5, | |
| 'under_threshold_fee' => 10 | |
| ), |
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
| AX Åland Islands | |
| AF Afghanistan | |
| AL Albania | |
| DZ Algeria | |
| AD Andorra | |
| AO Angola | |
| AI Anguilla | |
| AQ Antarctica | |
| AG Antigua and Barbuda | |
| AR Argentina |