Merge pull request #287 from typeplus/master
Woocommerce templates, Product Gallery & Phpcs fixes - Thx @typeplus
This commit is contained in:
commit
fde1960223
|
@ -24,11 +24,13 @@ $container = get_theme_mod( 'understrap_container_type' );
|
|||
<footer class="site-footer" id="colophon">
|
||||
|
||||
<div class="site-info">
|
||||
/* translators:*/
|
||||
<a href="<?php echo esc_url( __( 'http://wordpress.org/','understrap' ) ); ?>"><?php printf( esc_html__( 'Proudly powered by %s', 'understrap' ),'WordPress' ); ?></a>
|
||||
<span class="sep"> | </span>
|
||||
/* translators:*/
|
||||
<?php printf( // WPCS: XSS ok.
|
||||
esc_html__( 'Theme: %1$s by %2$s.', 'understrap' ), $the_theme->get( 'Name' ),
|
||||
'<a href="http://understrap.com/">understrap.com</a>' ); ?>
|
||||
esc_html__( 'Theme: %1$s by %2$s.', 'understrap' ), $the_theme->get( 'Name' ), '<a href="http://understrap.com/">understrap.com</a>' ); ?>
|
||||
/* translators:*/
|
||||
(<?php printf( // WPCS: XSS ok.
|
||||
esc_html__( 'Version: %1$s', 'understrap' ), $the_theme->get( 'Version' ) ); ?>)
|
||||
</div><!-- .site-info -->
|
||||
|
@ -50,3 +52,4 @@ $container = get_theme_mod( 'understrap_container_type' );
|
|||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
|
|
@ -11,6 +11,14 @@ if ( ! function_exists( 'woocommerce_support' ) ) {
|
|||
*/
|
||||
function woocommerce_support() {
|
||||
add_theme_support( 'woocommerce' );
|
||||
|
||||
// Add New Woocommerce 3.0.0 Product Gallery support
|
||||
add_theme_support( 'wc-product-gallery-lightbox' );
|
||||
add_theme_support( 'wc-product-gallery-zoom' );
|
||||
|
||||
// Gallery slider needs Flexslider - https://woocommerce.com/flexslider/
|
||||
//add_theme_support( 'wc-product-gallery-slider' );
|
||||
|
||||
// hook in and customizer form fields.
|
||||
add_filter( 'woocommerce_form_field_args', 'wc_form_field_args', 10, 3 );
|
||||
}
|
||||
|
|
|
@ -22,7 +22,11 @@
|
|||
<?php
|
||||
if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
|
||||
|
||||
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'understrap' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
|
||||
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'understrap' ), array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
),
|
||||
) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
|
||||
|
||||
<?php elseif ( is_search() ) : ?>
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ $sidebar_pos = get_theme_mod( 'understrap_sidebar_position' );
|
|||
<?php if ( have_posts() ) : ?>
|
||||
|
||||
<header class="page-header">
|
||||
|
||||
/* translators:*/
|
||||
<h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'understrap' ),
|
||||
'<span>' . get_search_query() . '</span>' ); ?></h1>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Cart Page
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,30 +13,29 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.3.8
|
||||
* @version 3.0.3
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
wc_print_notices();
|
||||
|
||||
do_action( 'woocommerce_before_cart' ); ?>
|
||||
|
||||
<form action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
<form class="woocommerce-cart-form" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
|
||||
<?php do_action( 'woocommerce_before_cart_table' ); ?>
|
||||
|
||||
<?php do_action( 'woocommerce_before_cart_table' ); ?>
|
||||
|
||||
<table class="shop_table shop_table_responsive cart table-hover table-striped" cellspacing="0">
|
||||
<table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="product-remove"> </th>
|
||||
<th class="product-thumbnail"> </th>
|
||||
<th class="product-name"><?php esc_html_e( 'Product', 'understrap' ); ?></th>
|
||||
<th class="product-price"><?php esc_html_e( 'Price', 'understrap' ); ?></th>
|
||||
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'understrap' ); ?></th>
|
||||
<th class="product-subtotal"><?php esc_html_e( 'Total', 'understrap' ); ?></th>
|
||||
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
|
||||
<th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
|
||||
<th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
|
||||
<th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -50,14 +49,14 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
|
||||
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
|
||||
?>
|
||||
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
<tr class="woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
|
||||
|
||||
<td class="product-remove">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
|
||||
'<a href="%s" class="remove" title="%s" data-product_id="%s" data-product_sku="%s">×</a>',
|
||||
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">×</a>',
|
||||
esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
|
||||
__( 'Remove this item', 'understrap' ),
|
||||
__( 'Remove this item', 'woocommerce' ),
|
||||
esc_attr( $product_id ),
|
||||
esc_attr( $_product->get_sku() )
|
||||
), $cart_item_key );
|
||||
|
@ -84,10 +83,10 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_title() ), $cart_item, $cart_item_key );
|
||||
}
|
||||
|
||||
// Meta data.
|
||||
// Meta data
|
||||
echo WC()->cart->get_item_data( $cart_item );
|
||||
|
||||
// Backorder notification.
|
||||
// Backorder notification
|
||||
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
|
||||
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'understrap' ) . '</p>';
|
||||
}
|
||||
|
@ -117,7 +116,7 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
?>
|
||||
</td>
|
||||
|
||||
<td class="product-subtotal" data-title="<?php _e( 'Total', 'understrap' ); ?>">
|
||||
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Total', 'understrap' ); ?>">
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
|
||||
?>
|
||||
|
@ -126,17 +125,16 @@ do_action( 'woocommerce_before_cart' ); ?>
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_cart_contents' );
|
||||
?>
|
||||
|
||||
<?php do_action( 'woocommerce_cart_contents' ); ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="6" class="actions">
|
||||
|
||||
<?php if ( wc_coupons_enabled() ) { ?>
|
||||
<div class="coupon">
|
||||
|
||||
<label for="coupon_code"><?php _e( 'Coupon:', 'understrap' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" /> <input type="submit" class=" btn btn-outline-primary" name="apply_coupon" value="<?php esc_attr_e( 'Apply Coupon', 'understrap' ); ?>" />
|
||||
|
||||
<label for="coupon_code"><?php _e( 'Coupon:', 'understrap' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'understrap' ); ?>" /> <input type="submit" class="btn btn-outline-primary" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'understrap' ); ?>" />
|
||||
<?php do_action( 'woocommerce_cart_coupon' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Loop Add to Cart
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/loop/add-to-cart.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.5.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -28,8 +28,6 @@ echo apply_filters( 'woocommerce_loop_add_to_cart_link',
|
|||
esc_attr( isset( $quantity ) ? $quantity : 1 ),
|
||||
esc_attr( $product->id ),
|
||||
esc_attr( $product->get_sku() ),
|
||||
// TODO: load add to cart button class from customizer?
|
||||
// esc_attr( isset( $class ) ? $class : 'button' ),
|
||||
esc_html( $product->add_to_cart_text() )
|
||||
),
|
||||
$product );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Downloads
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* Shows downloads on the account page.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/downloads.php.
|
||||
|
@ -15,7 +15,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -43,55 +43,55 @@ do_action( 'woocommerce_before_account_downloads', $has_downloads ); ?>
|
|||
<tr>
|
||||
<?php foreach ( wc_get_account_downloads_columns() as $column_id => $column_name ) : ?>
|
||||
<td class="<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>">
|
||||
<?php if ( has_action( 'woocommerce_account_downloads_column_' . $column_id ) ) : ?>
|
||||
<?php do_action( 'woocommerce_account_downloads_column_' . $column_id, $download ); ?>
|
||||
|
||||
<?php elseif ( 'download-file' === $column_id ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink( $download['product_id'] ) ); ?>">
|
||||
<?php echo esc_html( $download['download_name'] ); ?>
|
||||
</a>
|
||||
|
||||
<?php elseif ( 'download-remaining' === $column_id ) : ?>
|
||||
<?php
|
||||
if ( is_numeric( $download['downloads_remaining'] ) ) {
|
||||
echo esc_html( $download['downloads_remaining'] );
|
||||
if ( has_action( 'woocommerce_account_downloads_column_' . $column_id ) ) {
|
||||
do_action( 'woocommerce_account_downloads_column_' . $column_id, $download );
|
||||
} else {
|
||||
_e( '∞', 'understrap' );
|
||||
}
|
||||
?>
|
||||
|
||||
<?php elseif ( 'download-expires' === $column_id ) : ?>
|
||||
switch ( $column_id ) {
|
||||
case 'download-product' : ?>
|
||||
<a href="<?php echo esc_url( get_permalink( $download['product_id'] ) ); ?>">
|
||||
<?php echo esc_html( $download['product_name'] ); ?>
|
||||
</a>
|
||||
<?php break;
|
||||
case 'download-file' : ?>
|
||||
<a href="<?php echo esc_url( $download['download_url'] ); ?>" class="woocommerce-MyAccount-downloads-file">
|
||||
<?php echo esc_html( $download['file']['name'] ); ?>
|
||||
</a>
|
||||
<?php break;
|
||||
case 'download-remaining' :
|
||||
echo is_numeric( $download['downloads_remaining'] ) ? esc_html( $download['downloads_remaining'] ) : __( '∞', 'woocommerce' );
|
||||
break;
|
||||
case 'download-expires' : ?>
|
||||
<?php if ( ! empty( $download['access_expires'] ) ) : ?>
|
||||
<time datetime="<?php echo date( 'Y-m-d', strtotime( $download['access_expires'] ) ); ?>" title="<?php echo esc_attr( strtotime( $download['access_expires'] ) ); ?>"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $download['access_expires'] ) ); ?></time>
|
||||
<?php else : ?>
|
||||
<?php _e( 'Never', 'understrap' ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php elseif ( 'download-actions' === $column_id ) : ?>
|
||||
<?php break;
|
||||
case 'download-actions' : ?>
|
||||
<?php
|
||||
$actions = array(
|
||||
'download' => array(
|
||||
'url' => $download['download_url'],
|
||||
'name' => __( 'Download', 'understrap' )
|
||||
)
|
||||
'name' => __( 'Download', 'understrap' ),
|
||||
),
|
||||
);
|
||||
|
||||
if ( $actions = apply_filters( 'woocommerce_account_download_actions', $actions, $download ) ) {
|
||||
foreach ( $actions as $key => $action ) {
|
||||
echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-outline-primary ' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>';
|
||||
echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-outline-primary' . sanitize_html_class( $key ) . '">' . esc_html( $action['name'] ) . '</a>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<?php do_action( 'woocommerce_after_available_downloads' ); ?>
|
||||
|
||||
<?php else : ?>
|
||||
<div class="woocommerce-Message woocommerce-Message--info woocommerce-info">
|
||||
<a class="btn btn-outline-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Edit address form
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-edit-address.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,14 +13,14 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$page_title = ( $load_address === 'billing' ) ? __( 'Billing Address', 'understrap' ) : __( 'Shipping Address', 'understrap' );
|
||||
$page_title = ( 'billing' === $load_address ) ? __( 'Billing address', 'understrap' ) : __( 'Shipping address', 'understrap' );
|
||||
|
||||
do_action( 'woocommerce_before_edit_account_address_form' ); ?>
|
||||
|
||||
|
@ -30,23 +30,25 @@ do_action( 'woocommerce_before_edit_account_address_form' ); ?>
|
|||
|
||||
<form method="post">
|
||||
|
||||
<h3><?php echo apply_filters( 'woocommerce_my_account_edit_address_title', $page_title ); ?></h3>
|
||||
<h3><?php echo apply_filters( 'woocommerce_my_account_edit_address_title', $page_title, $load_address ); ?></h3>
|
||||
|
||||
<div class="woocommerce-address-fields">
|
||||
<?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?>
|
||||
|
||||
<div class="woocommerce-address-fields__field-wrapper">
|
||||
<?php foreach ( $address as $key => $field ) : ?>
|
||||
|
||||
<?php woocommerce_form_field( $key, $field, ! empty( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : $field['value'] ); ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?>
|
||||
|
||||
<p>
|
||||
<input type="submit" class="btn btn-outline-primary" name="save_address" value="<?php esc_attr_e( 'Save Address', 'understrap' ); ?>" />
|
||||
<input type="submit" class="btn btn-outline-primary" name="save_address" value="<?php esc_attr_e( 'Save address', 'understrap' ); ?>" />
|
||||
<?php wp_nonce_field( 'woocommerce-edit_address' ); ?>
|
||||
<input type="hidden" name="action" value="edit_address" />
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Lost password form
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-lost-password.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -35,7 +35,7 @@ wc_print_notices(); ?>
|
|||
|
||||
<?php do_action( 'woocommerce_lostpassword_form' ); ?>
|
||||
|
||||
<p class="woocommerce-FormRow form-row">
|
||||
<p class="woocommerce-form-row form-row">
|
||||
<input type="hidden" name="wc_reset_password" value="true" />
|
||||
<input type="submit" class="btn btn-outline-primary" value="<?php esc_attr_e( 'Reset Password', 'understrap' ); ?>" />
|
||||
</p>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Lost password reset form.
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-reset-password.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -30,7 +30,7 @@ wc_print_notices(); ?>
|
|||
<label for="password_1"><?php _e( 'New password', 'understrap' ); ?> <span class="required">*</span></label>
|
||||
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password_1" id="password_1" />
|
||||
</p>
|
||||
<p class="woocommerce-FormRow woocommerce-FormRow--last form-row form-row-last">
|
||||
<p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last">
|
||||
<label for="password_2"><?php _e( 'Re-enter new password', 'understrap' ); ?> <span class="required">*</span></label>
|
||||
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password_2" id="password_2" />
|
||||
</p>
|
||||
|
@ -42,7 +42,7 @@ wc_print_notices(); ?>
|
|||
|
||||
<?php do_action( 'woocommerce_resetpassword_form' ); ?>
|
||||
|
||||
<p class="woocommerce-FormRow form-row">
|
||||
<p class="woocommerce-form-row form-row">
|
||||
<input type="hidden" name="wc_reset_password" value="true" />
|
||||
<input type="submit" class="btn btn-outline-primary" value="<?php esc_attr_e( 'Save', 'understrap' ); ?>" />
|
||||
</p>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Orders
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* Shows orders on the account page.
|
||||
*
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/orders.php.
|
||||
|
@ -15,7 +15,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -26,11 +26,11 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
|||
|
||||
<?php if ( $has_orders ) : ?>
|
||||
|
||||
<table class="woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table table-hover table-striped">
|
||||
<table class="woocommerce-orders-table woocommerce-MyAccount-orders shop_table shop_table_responsive my_account_orders account-orders-table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?>
|
||||
<th class="<?php echo esc_attr( $column_id ); ?>"><span class="nobr"><?php echo esc_html( $column_name ); ?></span></th>
|
||||
<th class="woocommerce-orders-table__header woocommerce-orders-table__header-<?php echo esc_attr( $column_id ); ?>"><span class="nobr"><?php echo esc_html( $column_name ); ?></span></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -40,9 +40,9 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
|||
$order = wc_get_order( $customer_order );
|
||||
$item_count = $order->get_item_count();
|
||||
?>
|
||||
<tr class="order">
|
||||
<tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order">
|
||||
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?>
|
||||
<td class="<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>">
|
||||
<td class="woocommerce-orders-table__cell woocommerce-orders-table__cell-<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>">
|
||||
<?php if ( has_action( 'woocommerce_my_account_my_orders_column_' . $column_id ) ) : ?>
|
||||
<?php do_action( 'woocommerce_my_account_my_orders_column_' . $column_id, $order ); ?>
|
||||
|
||||
|
@ -52,13 +52,16 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
|||
</a>
|
||||
|
||||
<?php elseif ( 'order-date' === $column_id ) : ?>
|
||||
<time datetime="<?php echo date( 'Y-m-d', strtotime( $order->order_date ) ); ?>" title="<?php echo esc_attr( strtotime( $order->order_date ) ); ?>"><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></time>
|
||||
<time datetime="<?php echo esc_attr( $order->get_date_created()->date( 'c' ) ); ?>"><?php echo esc_html( wc_format_datetime( $order->get_date_created() ) ); ?></time>
|
||||
|
||||
<?php elseif ( 'order-status' === $column_id ) : ?>
|
||||
<?php echo wc_get_order_status_name( $order->get_status() ); ?>
|
||||
<?php echo esc_html( wc_get_order_status_name( $order->get_status() ) ); ?>
|
||||
|
||||
<?php elseif ( 'order-total' === $column_id ) : ?>
|
||||
<?php echo sprintf( _n( '%s for %s item', '%s for %s items', $item_count, 'understrap' ), $order->get_formatted_order_total(), $item_count ); ?>
|
||||
<?php
|
||||
/* translators: 1: formatted order total 2: total order items */
|
||||
printf( _n( '%1$s for %2$s item', '%1$s for %2$s items', $item_count, 'understrap' ), $order->get_formatted_order_total(), $item_count );
|
||||
?>
|
||||
|
||||
<?php elseif ( 'order-actions' === $column_id ) : ?>
|
||||
<?php
|
||||
|
@ -102,21 +105,21 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
|||
<?php do_action( 'woocommerce_before_account_orders_pagination' ); ?>
|
||||
|
||||
<?php if ( 1 < $customer_orders->max_num_pages ) : ?>
|
||||
<div class="woocommerce-Pagination">
|
||||
<div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination">
|
||||
<?php if ( 1 !== $current_page ) : ?>
|
||||
<a class="woocommerce-Button woocommerce-Button--previous button" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page - 1 ) ); ?>"><?php _e( 'Previous', 'understrap' ); ?></a>
|
||||
<a class="woocommerce-button woocommerce-button--previous woocommerce-Button woocommerce-Button--previous button" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page - 1 ) ); ?>"><?php _e( 'Previous', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $current_page !== intval( $customer_orders->max_num_pages ) ) : ?>
|
||||
<a class="woocommerce-Button woocommerce-Button--next btn btn-outline-primary" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page + 1 ) ); ?>"><?php _e( 'Next', 'understrap' ); ?></a>
|
||||
<?php if ( intval( $customer_orders->max_num_pages ) !== $current_page ) : ?>
|
||||
<a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next btn btn-outline-primary" href="<?php echo esc_url( wc_get_endpoint_url( 'orders', $current_page + 1 ) ); ?>"><?php _e( 'Next', 'woocommerce' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php else : ?>
|
||||
<div class="woocommerce-Message woocommerce-Message--info woocommerce-info">
|
||||
<div class="woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info">
|
||||
<a class="btn btn-outline-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
|
||||
<?php _e( 'Go Shop', 'understrap' ) ?>
|
||||
<?php _e( 'Go shop', 'understrap' ) ?>
|
||||
</a>
|
||||
<?php _e( 'No order has been made yet.', 'understrap' ); ?>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Simple product add to cart
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,11 +13,10 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.1.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
exit;
|
||||
}
|
||||
|
||||
global $product;
|
||||
|
@ -26,38 +25,44 @@ if ( ! $product->is_purchasable() ) {
|
|||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
echo wc_get_stock_html( $product );
|
||||
|
||||
<?php
|
||||
// Availability
|
||||
$availability = $product->get_availability();
|
||||
$availability_html = empty( $availability['availability'] ) ? '' : '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>';
|
||||
|
||||
echo apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product );
|
||||
?>
|
||||
|
||||
<?php if ( $product->is_in_stock() ) : ?>
|
||||
if ( $product->is_in_stock() ) : ?>
|
||||
|
||||
<?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
|
||||
|
||||
<form class="cart" method="post" enctype='multipart/form-data'>
|
||||
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
|
||||
|
||||
<?php
|
||||
if ( ! $product->is_sold_individually() ) {
|
||||
/**
|
||||
* @since 2.1.0.
|
||||
*/
|
||||
do_action( 'woocommerce_before_add_to_cart_button' );
|
||||
|
||||
/**
|
||||
* @since 3.0.0.
|
||||
*/
|
||||
do_action( 'woocommerce_before_add_to_cart_quantity' );
|
||||
|
||||
woocommerce_quantity_input( array(
|
||||
'min_value' => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
|
||||
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product ),
|
||||
'input_value' => ( isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : 1 )
|
||||
'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
|
||||
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
|
||||
'input_value' => isset( $_POST['quantity'] ) ? wc_stock_amount( $_POST['quantity'] ) : $product->get_min_purchase_quantity(),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0.0.
|
||||
*/
|
||||
do_action( 'woocommerce_after_add_to_cart_quantity' );
|
||||
?>
|
||||
|
||||
<input type="hidden" name="add-to-cart" value="<?php echo esc_attr( $product->id ); ?>" />
|
||||
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
|
||||
|
||||
<button type="submit" class="btn btn-outline-primary"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
|
||||
|
||||
<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
|
||||
<?php
|
||||
/**
|
||||
* @since 2.1.0.
|
||||
*/
|
||||
do_action( 'woocommerce_after_add_to_cart_button' );
|
||||
?>
|
||||
</form>
|
||||
|
||||
<?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Single Product Thumbnails
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,59 +13,35 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.3
|
||||
* @version 3.0.2
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $post, $product, $woocommerce;
|
||||
global $post, $product;
|
||||
|
||||
$attachment_ids = $product->get_gallery_attachment_ids();
|
||||
|
||||
if ( $attachment_ids ) {
|
||||
$loop = 0;
|
||||
$columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
|
||||
?>
|
||||
<div class="thumbnails <?php echo 'columns-' . $columns; ?>"><?php
|
||||
$attachment_ids = $product->get_gallery_image_ids();
|
||||
|
||||
if ( $attachment_ids && has_post_thumbnail() ) {
|
||||
foreach ( $attachment_ids as $attachment_id ) {
|
||||
$full_size_image = wp_get_attachment_image_src( $attachment_id, 'full' );
|
||||
$thumbnail = wp_get_attachment_image_src( $attachment_id, 'shop_thumbnail' );
|
||||
$image_title = get_post_field( 'post_excerpt', $attachment_id );
|
||||
|
||||
$classes = array( 'zoom' );
|
||||
|
||||
if ( $loop === 0 || $loop % $columns === 0 ) {
|
||||
$classes[] = 'first';
|
||||
}
|
||||
|
||||
if ( ( $loop + 1 ) % $columns === 0 ) {
|
||||
$classes[] = 'last';
|
||||
}
|
||||
|
||||
$image_class = implode( ' ', $classes );
|
||||
$props = wc_get_product_attachment_props( $attachment_id, $post );
|
||||
|
||||
if ( ! $props['url'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo apply_filters(
|
||||
'woocommerce_single_product_image_thumbnail_html',
|
||||
sprintf(
|
||||
'<a href="%s" class="%s img-thumbnail" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>',
|
||||
esc_url( $props['url'] ),
|
||||
esc_attr( $image_class ),
|
||||
esc_attr( $props['caption'] ),
|
||||
wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props )
|
||||
),
|
||||
$attachment_id,
|
||||
$post->ID,
|
||||
esc_attr( $image_class )
|
||||
$attributes = array(
|
||||
'title' => $image_title,
|
||||
'data-src' => $full_size_image[0],
|
||||
'data-large_image' => $full_size_image[0],
|
||||
'data-large_image_width' => $full_size_image[1],
|
||||
'data-large_image_height' => $full_size_image[2],
|
||||
);
|
||||
|
||||
$loop++;
|
||||
}
|
||||
$html = '<div data-thumb="' . esc_url( $thumbnail[0] ) . '" class="woocommerce-product-gallery__image"><a href="' . esc_url( $full_size_image[0] ) . '">';
|
||||
$html .= wp_get_attachment_image( $attachment_id, 'shop_single', false, $attributes );
|
||||
$html .= '</a></div>';
|
||||
|
||||
?></div>
|
||||
<?php
|
||||
echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', $html, $attachment_id );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* The template to display the reviewers star rating in reviews
|
||||
*
|
||||
* Updated for Understrap to maintain Woocommerce 3.0.3 compatability.
|
||||
* This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
|
||||
*
|
||||
* HOWEVER, on occasion WooCommerce will need to update template files and you
|
||||
|
@ -13,7 +13,7 @@
|
|||
* @see https://docs.woocommerce.com/document/template-structure/
|
||||
* @author WooThemes
|
||||
* @package WooCommerce/Templates
|
||||
* @version 2.6.0
|
||||
* @version 3.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
@ -25,8 +25,11 @@ $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
|
|||
|
||||
if ( $rating && get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { ?>
|
||||
|
||||
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating text-primary" title="<?php echo sprintf( esc_attr__( 'Rated %d out of 5', 'understrap' ), esc_attr( $rating ) ) ?>">
|
||||
<span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo esc_attr( $rating ); ?></strong> <?php esc_attr_e( 'out of 5', 'understrap' ); ?></span>
|
||||
<div class="star-rating">
|
||||
<span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><?php
|
||||
/* translators: %s: rating */
|
||||
printf( esc_html__( '%s out of 5', 'understrap' ), '<strong>' . $rating . '</strong>' );
|
||||
?></span>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
|
|
Reference in New Issue