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: My Widget | |
| Plugin URI: http://mydomain.com | |
| Description: My first widget | |
| Author: Me | |
| Version: 1.0 | |
| Author URI: http://mydomain.com | |
| */ |
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 | |
| // Display variations dropdowns on shop page for variable products | |
| add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' ); | |
| function woo_display_variation_dropdown_on_shop_page() { | |
| global $product; | |
| if( $product->is_type( 'variable' )) { | |
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( 'pre_get_posts', 'change_posts_order_per_category' ); | |
| function change_posts_order_per_category( $query ) { | |
| if ( ! is_admin() && $query->is_main_query() && $query->is_archive() && $query->get( 'cat' ) ) { // change 'cat' to your actual category slug | |
| $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
| //************ Create custom taxonomy for woocommerce ************ | |
| function create_product_taxonomy() { | |
| $labels = array( | |
| 'name' => _x( 'Product Categories', 'taxonomy general name' ), | |
| 'singular_name' => _x( 'Product Category', 'taxonomy singular name' ), | |
| 'search_items' => __( 'Search Product Categories' ), | |
| 'all_items' => __( 'All Product Categories' ), | |
| 'parent_item' => __( 'Parent Product Category' ), | |
| 'parent_item_colon' => __( 'Parent Product Category:' ), | |
| 'edit_item' => __( 'Edit Product Category' ), |
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 | |
| /** | |
| * This code shows pagination for WooCommerce shortcodes when it's embeded on single pages. | |
| * Include into functions.php. | |
| */ | |
| if ( ! is_admin() ) { | |
| // ---------------------- FRONTPAGE ------------------- | |
| if ( defined('WC_VERSION') ) { |