-
Notifications
You must be signed in to change notification settings - Fork 0
/
codes
101 lines (91 loc) · 4.48 KB
/
codes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
==== REDIRECT NOT FOUND PAGE TO HOME PAGE ====
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>
==================================================================================================================================================================================
==== EDIT WOOCOMERCE FILES ====
--STEP 1 --
ADD WOOMERCE THEME SUPPORT IN FUNCTION FILE
function mytheme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
-- STEP 2 --
Edit files in an upgrade-safe way using overrides. Copy the template into a directory within your theme named /woocommerce keeping the same file structure but removing the /templates/ subdirectory.
Example: To override the admin order notification, copy: wp-content/plugins/woocommerce/templates/emails/admin-new-order.php to wp-content/themes/yourtheme/woocommerce/emails/admin-new-order.php
Warning: Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customizations will be lost.
-LINK FOR MORE INFORMATION-
https://woocommerce.com/document/template-structure/
==================================================================================================================================================================================
==== DISPLAY ALL PRODUCTS IN OWL CAROUSEL WOOCOMMERCE ====
<ul class="slides">
<div class="product-carousel owl-carousel owl-theme ">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 10,
'order' => 'ASC',
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post()
global $product;?>
<div class="img-box">
<a href="<?php echo get_permalink( $product->get_id() ); ?>">
<div class="products-images">
<?php echo $product->get_image(); ?>
</div>
</a>
<a href="<?php echo get_permalink( $product->get_id() ); ?>">
<h4><?php echo $product->get_title() ?></h4>
<p><?php echo $product->get_short_description(); ?></p>
</a>
<div class="price-btn">
<span><?php echo $product->get_price_html(); ?></span>
<a href="<?php echo get_permalink( $product->get_id() ); ?>" class="btn-add-to-cart"><span class="icons"></span>ADD TO CART</a>
</div>
</div>
<?php
endwhile;
wp_reset_query();
?>
</div>
</ul>
==================================================================================================================================================================================
==================================================================================================================================================================================
/**
* CHANGE NUMBER OF PRODUCT PER ROW TO 3 FOR PRODUCT PAGE
*/
add_filter('loop_shop_columns', 'loop_columns', 999);
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}
add_action( 'woocommerce_after_shop_loop_item_title', 'tutsplus_excerpt_in_product_archives', 40 );
==================================================================================================================================================================================
/**
* CHANGE NUMBER OF PRODUCT PER ROW TO 3 FOR RELATED PRODUCTS
*/
function woo_related_products_limit() {
global $product;
$args['posts_per_page'] = 6;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args', 20 );
function jk_related_products_args( $args ) {
$args['posts_per_page'] = 3; // 4 related products
$args['columns'] = 3; // arranged in 2 columns
return $args;
}
-LINK FOR MORE INFORMATION-
https://woocommerce.com/document/change-number-of-products-per-row/
==================================================================================================================================================================================
==== ADD LIGHT BOX SLIDER TO SINGLEPRODUCT IMAGE PAGE ====
function yourtheme_setup() {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
add_action( 'woocommerce_single_product_summary' ,'actual_discription');