Last active
December 22, 2015 09:38
-
-
Save marcosfreitas/6452881 to your computer and use it in GitHub Desktop.
my custom loop of woocommerce archive-product.php
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 | |
/** | |
* The Template for displaying product archives, including the main shop page which is a post type archive. | |
* | |
* Overriding original archive-product.php | |
* | |
* @author Marcos Freitas | |
* @package WooCommerce/Templates | |
* @version 1.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
get_header('shop'); | |
?> | |
<div class="container"> | |
<div class="space-ten"></div> | |
<?php | |
#the_breadcrumb(); | |
if ( function_exists('yoast_breadcrumb') ) { | |
$breadcrumbs = yoast_breadcrumb("<div class=\"breadcrumbs\">","</div>"); | |
} ?> | |
<div class="space-ten"></div> | |
<?php echo do_shortcode("[headerText header='Loja ON Services']"); ?> | |
<div id="single-pages"> | |
<div class="pull-left col-a"> | |
<? | |
#header store | |
if(file_exists(dirname(__FILE__) . '\header-store-ons.php')) | |
require_once(dirname(__FILE__) . '\header-store-ons.php'); | |
else | |
echo "<div class=\"alert alert-error\"><i class=\"icon icon-thumbs-down\"></i> Não foi possível localizar o cabeçalho da loja, por favor entre em contato conosco: ".antispambot("[email protected]")."</div>"; | |
?> | |
<div class="main"> | |
<?php | |
if(have_posts()) : | |
echo '<div class="container-fluid"><div class="row-fluid"><div class="well well-small span12">'; | |
do_action( 'woocommerce_before_shop_loop' ); | |
echo '</div></div></div>'; | |
echo '<div class="clearfix"></div>'; | |
$cont = 0; | |
woocommerce_product_loop_start(); //begin auto ul.products | |
while(have_posts()) : the_post(); | |
$cont++; | |
if ( has_post_thumbnail() ): // check if the post has a Post Thumbnail assigned to it. | |
echo '<li class="noPretty">'; | |
echo '<a href="'.get_permalink().'" style="height: auto; width: auto">'; | |
echo '<div class="service-content">'; | |
echo '<div class="caps-polaroid">'; | |
echo '<div class="content-img noPretty">'; | |
the_post_thumbnail('thumbnail', array("alt" => get_the_title(), "class" => 'noPretty')); | |
echo '<a href="'; | |
$linkto = get_url_desc_box(); | |
if(strlen($linkto[0]) > 8){ | |
echo $linkto[0].'" '; | |
}else{ | |
echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ).'"'; | |
} | |
echo '>'; // end <a> | |
echo '</a>'; //end tag <a></a> | |
echo '</div>'; // end .content-img | |
echo '</div>'; // end .caps-polaroid | |
echo '<div class="clearfix"></div>'; | |
echo '<div class="service-post-entry">'; | |
echo '<div class="service-post-content">'; | |
echo '<div class="service-post-title">'; | |
$p_link = get_permalink(); | |
echo '<h2><a href="'.$p_link.'">'; | |
the_title(); | |
echo '</a></h2>'; | |
echo '</div>'; | |
echo '<div class="service-post-price">'; | |
//echo '<span class="price">'.$product->get_price_including_tax().'</span>'; | |
echo '<span class="installments">'; | |
do_action( 'woocommerce_after_shop_loop_item_title', 'cs_product_parceled_loop', 20 ); | |
//do_action( 'woocommerce_single_product_summary', 'cs_product_parceled_single', 10 ); | |
echo '</span>'; | |
echo '</div>'; | |
echo '</div>'; | |
//var_dump($product); | |
global $product; | |
$link = esc_url( $product->add_to_cart_url() ); | |
$btn_add_to_cart = apply_filters('add_to_cart_text', __('Inscrever-se', 'woocommerce')); | |
echo '<div class="service-post-btn">'; | |
// woocommerce_quantity_input(); | |
echo '<a href="'.$p_link.'" data-toggle="tooltip" data-original-title="Veja Mais" data-placement="top" title="Veja Mais" class="btn btn-inverse btn-small null-radius pull-left"><i class="icon icon-info-sign"></i></a>'; | |
echo '<form action="'.$link.'" class="cart pull-right" method="post" enctype=\'multipart/form-data\'>'; | |
echo '<button type="submit" class="btn add_to_cart_button btn-small null-radius"><i class="icon icon-white icon-shopping-cart"></i> '.$btn_add_to_cart.'</button>'; | |
echo '</form>'; | |
echo '</div>'; | |
//echo '<div class="service-post-content">'; | |
//var_dump($product); | |
// echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); | |
//echo '</div>'; | |
echo '</div>'; | |
echo '</div>';// end .service-content | |
echo '</a>';// end .a link | |
echo '</li>'; | |
endif; // end of has_post_thumbnail | |
?> | |
<?php | |
endwhile; | |
echo '<div class="clearfix"></div>'; | |
woocommerce_product_loop_end(); // end auto ul.products | |
?> | |
<?php | |
wp_reset_query(); | |
/** | |
* woocommerce_after_shop_loop hook | |
* | |
* @hooked woocommerce_pagination - 10 | |
*/ | |
echo '<div class="container-fluid"><div class="row-fluid"><div class="well well-small span12">'; | |
do_action( 'woocommerce_after_shop_loop' ); | |
echo '</div></div></div>'; | |
elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : | |
woocommerce_get_template( 'loop/no-products-found.php' ); | |
endif; ?> | |
<div class="header-vertical-space"></div> | |
</div> | |
</div> <!-- //.col-a--> | |
<?php | |
/** | |
* woocommerce_sidebar hook | |
* | |
* @hooked woocommerce_get_sidebar - 10 | |
*/ | |
do_action('woocommerce_sidebar'); | |
//if($sidebar == "right-sidebar"){get_sidebar();} | |
?> | |
<div class="clearfix"></div> | |
</div> <!-- // end .single-pages --> | |
</div> <!-- //end .container --> | |
<?php get_footer();?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment