Ejemplo n.º 1
0
function hocwp_article_header($args = array())
{
    $loop = isset($args['loop']) ? $args['loop'] : false;
    $entry_meta = isset($args['entry_meta']) ? $args['entry_meta'] : true;
    ?>
	<header class="entry-header">
		<?php 
    if (!$loop && (is_single() || is_singular())) {
        hocwp_post_title_single();
    } else {
        hocwp_post_title_link();
    }
    if (!is_page() && $entry_meta) {
        ?>
			<div class="entry-meta">
				<?php 
        hocwp_entry_meta();
        ?>
			</div><!-- .entry-meta -->
			<?php 
    }
    ?>
	</header><!-- .entry-header -->
	<?php 
}
Ejemplo n.º 2
0
<div class="<?php 
hocwp_wrap_class();
?>
">
	<?php 
hocwp_breadcrumb();
hocwp_theme_site_main_before();
hocwp_article_before();
hocwp_post_title_single();
hocwp_entry_content();
hocwp_article_after();
hocwp_theme_site_main_after();
get_sidebar('page');
?>
</div>
Ejemplo n.º 3
0
function hocwp_wc_single_product_fast_buy_button($args = array())
{
    $use = hocwp_wc_use_fast_buy_button();
    if ($use) {
        global $product;
        $backup = $product;
        $post_id = hocwp_get_value_by_key($args, 'post_id');
        $post_id = hocwp_return_post($post_id, 'id');
        $tmp = new WC_Product($product);
        $product = $tmp;
        $show_button = (bool) hocwp_get_value_by_key($args, 'show_button', true);
        hocwp_div_clear();
        do_action('hocwp_wc_before_fast_buy_button');
        if ($show_button) {
            $args['post_id'] = $post_id;
            hocwp_wc_product_fast_buy_button($args);
        }
        ?>
		<div id="productBuy<?php 
        echo $post_id;
        ?>
" role="dialog" tabindex="-1" class="modal fade product-fast-buy">
			<div class="modal-dialog">
				<div class="modal-content clearfix">
					<div class="modal-header">
						<button aria-label="Close" data-dismiss="modal" class="close" type="button"><span
								aria-hidden="true">×</span></button>
						<h4 class="modal-title"><?php 
        _e('Fast order', 'hocwp-theme');
        ?>
</h4>
					</div>
					<div class="modal-body">
						<div class="row row-medium">
							<div class="col-xs-12 col-md-6 info-column">
								<div class="product-info">
									<?php 
        hocwp_post_thumbnail(array('bfi_thumb' => false, 'loop' => false));
        hocwp_post_title_single(array('tag' => 'h2'));
        $get_variations = sizeof($product->get_children()) <= apply_filters('woocommerce_ajax_variation_threshold', 30, $product);
        $attributes = array();
        if (hocwp_wc_is_variable($product)) {
            $tmp = new WC_Product_Variable($product);
            $product = $tmp;
            $attributes = $product->get_variation_attributes();
        }
        $attribute_keys = array_keys($attributes);
        //$selected_attributes = $product->get_variation_default_attributes();
        $available_variations = false;
        if (hocwp_wc_is_variable($product)) {
            $available_variations = $get_variations ? $product->get_available_variations() : false;
        }
        if (empty($available_variations) && false !== $available_variations) {
            ?>
										<p class="stock out-of-stock"><?php 
            _e('This product is currently out of stock and unavailable.', 'hocwp-theme');
            ?>
</p>
									<?php 
        } else {
            ?>
										<?php 
            if (hocwp_array_has_value($attributes)) {
                ?>
											<form class="variations_form cart attributes-form" method="post">
												<table class="variations" cellspacing="0">
													<tbody>
													<?php 
                foreach ($attributes as $attribute_name => $options) {
                    ?>
														<tr>
															<td class="label"><label
																	for="<?php 
                    echo sanitize_title($attribute_name);
                    ?>
"><?php 
                    echo wc_attribute_label($attribute_name);
                    ?>
</label>
															</td>
															<td class="value">
																<?php 
                    $selected = isset($_REQUEST['attribute_' . sanitize_title($attribute_name)]) ? wc_clean($_REQUEST['attribute_' . sanitize_title($attribute_name)]) : $product->get_variation_default_attribute($attribute_name);
                    wc_dropdown_variation_attribute_options(array('options' => $options, 'attribute' => $attribute_name, 'product' => $product, 'selected' => $selected));
                    echo end($attribute_keys) === $attribute_name ? apply_filters('woocommerce_reset_variations_link', '<a class="reset_variations" href="#">' . __('Clear', 'hocwp-theme') . '</a>') : '';
                    ?>
															</td>
														</tr>
													<?php 
                }
                ?>
													</tbody>
												</table>
											</form>
										<?php 
            }
            ?>
									<?php 
        }
        hocwp_wc_product_price(null, true);
        ?>
								</div>
							</div>
							<div class="col-xs-12 col-md-6 customer-column">
								<div class="customer-info">
									<?php 
        $name = '';
        $email = '';
        $phone = '';
        $address = '';
        if (is_user_logged_in()) {
            $current = wp_get_current_user();
            $name = get_user_meta($current->ID, 'billing_first_name', true);
            $last_name = get_user_meta($current->ID, 'billing_last_name', true);
            if (!empty($last_name)) {
                $name = $last_name . ' ' . $name;
            }
            $name = trim($name);
            if (empty($name)) {
                $name = $current->display_name;
            }
            $email = get_user_meta($current->ID, 'billing_email', true);
            if (!is_email($email)) {
                $email = $current->user_email;
            }
            $phone = get_user_meta($current->ID, 'billing_phone', true);
            $address = get_user_meta($current->ID, 'billing_address_1', true);
        }
        ?>
									<form class="order-form" method="post">
										<div class="form-group">
											<p><?php 
        echo sprintf(__('Required fields are marked as %s', 'hocwp-theme'), HOCWP_REQUIRED_HTML);
        ?>
</p>
										</div>
										<div class="form-group">
											<input type="text" required aria-required="true"
											       value="<?php 
        echo $name;
        ?>
" class="full-name form-control"
											       placeholder="<?php 
        _e('Full name *', 'hocwp-theme');
        ?>
"
											       name="fullname">
										</div>
										<div class="form-group">
											<input type="text" class="phone form-control" value="<?php 
        echo $phone;
        ?>
"
											       placeholder="<?php 
        _e('Phone', 'hocwp-theme');
        ?>
" name="phone">
										</div>
										<div class="form-group">
											<input type="text" required aria-required="true"
											       value="<?php 
        echo $email;
        ?>
" class="email form-control"
											       placeholder="<?php 
        _e('Email *', 'hocwp-theme');
        ?>
" name="email">
										</div>
										<div class="form-group">
											<input type="text" class="address form-control"
											       value="<?php 
        echo $address;
        ?>
"
											       placeholder="<?php 
        _e('Address', 'hocwp-theme');
        ?>
"
											       name="address">
										</div>
										<div class="form-group">
											<label for="message"><?php 
        _e('Note:', 'hocwp-theme');
        ?>
</label>
											<textarea id="message" name="message"
											          class="message form-control"></textarea>
										</div>
										<div class="form-group">
											<button class="btn-clickable orange" data-id="<?php 
        echo $post_id;
        ?>
">
												<span><?php 
        _e('Put order', 'hocwp-theme');
        ?>
</span>
											</button>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php 
        $product = $backup;
    }
}