本文整理汇总了PHP中woocommerce_get_product_thumbnail函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_get_product_thumbnail函数的具体用法?PHP woocommerce_get_product_thumbnail怎么用?PHP woocommerce_get_product_thumbnail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_get_product_thumbnail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_thumbnail
/**
* Product loop thumbnail
*
*/
function show_thumbnail()
{
echo '<div class="product-item__preview">';
echo woocommerce_template_loop_product_link_open();
echo woocommerce_get_product_thumbnail();
echo woocommerce_template_loop_product_link_close();
echo '</div>';
}
示例2: product_thumbnail_with_cart
function product_thumbnail_with_cart()
{
?>
<div class="product-thumb-wrap">
<?php
echo woocommerce_get_product_thumbnail();
?>
<?php
woocommerce_get_template('loop/add-to-cart.php');
?>
</div>
<?php
}
示例3: woocommerce_template_loop_product_thumbnail
function woocommerce_template_loop_product_thumbnail()
{
?>
<a href="<?php
the_permalink();
?>
">
<figure class="item-thumb">
<?php
echo woocommerce_get_product_thumbnail();
?>
</figure>
</a>
<?php
}
示例4: woocommerce_template_loop_product_thumbnail
/**
* Get the product thumbnail for the loop.
*
* @access public
* @subpackage Loop
* @return void
*/
function woocommerce_template_loop_product_thumbnail()
{
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
$secondary_image = '';
if ($attachment_ids) {
$secondary_image_id = $attachment_ids['0'];
$secondary_image = wp_get_attachment_image($secondary_image_id, apply_filters('shop_catalog', 'shop_catalog'));
}
?>
<div class="product-thumb-container">
<?php
if (has_post_thumbnail()) {
?>
<div class="product-thumb-primary">
<?php
echo woocommerce_get_product_thumbnail();
?>
</div>
<?php
if (!empty($secondary_image)) {
?>
<div class="product-thumb-secondary">
<?php
echo wp_kses_post($secondary_image);
?>
</div>
<?php
}
?>
<?php
} elseif (!empty($secondary_image)) {
?>
<div class="product-thumb-primary">
<?php
echo wp_kses_post($secondary_image);
?>
</div>
<?php
}
?>
</div>
<?php
}
示例5: custom_woo_thumb
function custom_woo_thumb()
{
global $product;
?>
<div class="thumb">
<?php
echo woocommerce_get_product_thumbnail();
?>
<div class="icon-more">
<div class="icon icon-animate-left">
<i class="fa fa-link"></i>
</div>
<div class="icon icon-animate-right">
<?php
echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button %s product_type_%s">%s</a>', esc_url($product->add_to_cart_url()), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr(isset($quantity) ? $quantity : 1), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', esc_attr($product->product_type), '<i class="fa fa-shopping-cart"></i>'), $product);
?>
</div>
</div>
</div>
<?php
}
示例6: vk_display_plays
function vk_display_plays($date, $city)
{
global $wpdb;
$querystr = "\n\t SELECT {$wpdb->posts}.*\n\t FROM {$wpdb->posts}, {$wpdb->postmeta}, {$wpdb->terms}, {$wpdb->term_relationships}\n\t WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id\n\t AND {$wpdb->postmeta}.meta_key = '_vk_date_input'\n\t AND {$wpdb->postmeta}.meta_value LIKE '%" . $date . "%'\n\t\t\t\t\tAND {$wpdb->term_relationships}.object_id = {$wpdb->postmeta}.post_id\n\t\t\t\t\tAND {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->terms}.term_id\n\t\t\t\t\tAND {$wpdb->terms}.name ='" . $city . "'";
$pageposts = $wpdb->get_results($querystr, OBJECT);
?>
</br>
<?php
$count = 1;
if ($pageposts) {
?>
<?php
global $post;
?>
<?php
foreach ($pageposts as $post) {
?>
<?php
$html = woocommerce_get_product_thumbnail('shop_catalog');
$xpath = new DOMXPath(@DOMDocument::loadHTML($html));
$img_src = $xpath->evaluate("string(//img/@src)");
?>
<?php
if ($count == 1) {
echo '<div class="row">';
}
?>
<div class="col-xs-6 col-md-4">
<a href="<?php
the_permalink();
?>
" >
<img class="img-top" src="<?php
echo $img_src;
?>
" width="300" height="300" alt="<?php
the_title();
?>
">
</a>
<h4 class="title"><a href="<?php
the_permalink();
?>
" ><?php
the_title();
?>
</a></h4>
<small class="text-muted">
<?php
$meta_time = get_post_meta($post->ID, '_vk_time_input', true);
if ($meta_time) {
echo '<span class="glyphicon glyphicon-time"></span> ' . $meta_time . '<br/>';
}
$taxonomyName = "product_cat";
$parent_terms = wp_get_post_terms($post->ID, $taxonomyName, array('parent' => 0, 'orderby' => 'slug', 'hide_empty' => false));
echo '<span class="glyphicon glyphicon-map-marker"></span>';
foreach ($parent_terms as $pterm) {
$terms = wp_get_post_terms($post->ID, $taxonomyName, array('parent' => $pterm->term_id, 'orderby' => 'slug', 'hide_empty' => false));
foreach ($terms as $term) {
echo '<a href="' . get_term_link($term->name, $taxonomyName) . '">' . $term->name . '</a>';
}
}
?>
</small>
<hr/>
</div>
<?php
if ($count == 3) {
echo '</div>';
$count = 0;
}
$count++;
?>
<?php
}
if (count($pageposts) % 2 == 0 || count($pageposts) == 1) {
echo "</div>";
}
?>
<?php
} else {
?>
<h2 class="center">Няма резултати</h2>
<p class="center">Съжалявам, търсите нещо, което не е тук.</p>
<?php
include TEMPLATEPATH . "/searchform.php";
?>
<?php
}
}
示例7: ob_get_clean
*
* @hooked woocommerce_show_product_loop_sale_flash - 10
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
/* ob_start();
do_action( 'woocommerce_before_shop_loop_item_title' );
$data = ob_get_clean();
$pattern = '|<img.*src="([^"]*)".*>|';
preg_match($pattern, $data, $matches);
$img_tag = isset($matches[0]) ? $matches[0] : "";
$img_url = isset($matches[1]) ? $matches[1] : "";
$replacement = "<div class='pic'><div class='links'><a class='fancy fa fa-eye' href='" . $img_url . "'></a></div><div class='hover-effect'></div><img src='" . $img_url . "'></div>";
$data = preg_replace('|' . $img_tag . '|', $replacement, $data);
echo $data;*/
woocommerce_show_product_loop_sale_flash();
$img = woocommerce_get_product_thumbnail('full');
preg_match('|<img.*src="([^"]+)".*>|', $img, $matches);
$img_url = isset($matches[1]) ? $matches[1] : "";
if (!empty($img_url)) {
$dims = get_option('shop_catalog_image_size');
$thumb_url = bfi_thumb($img_url, $dims);
echo "<div class='pic'><img src='{$thumb_url}' alt /><div class='hover-effect'></div><div class='links'><a class='fancy fa fa-eye' href='{$img_url}'></a></div></div>";
//echo "<a class='fancy fa fa-eye' href='$img_url'></a>";
}
//woocommerce_template_loop_product_thumbnail();
?>
<h3><a href="<?php
the_permalink();
?>
"><?php
示例8: do_action
<div class="product-container">
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<div class="left-block">
<a href="<?php
echo get_permalink();
?>
">
<?php
/**
* kt_loop_product_thumbnail hook
*
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
echo woocommerce_get_product_thumbnail('shop_catalog_image_size');
?>
</a>
<div class="quick-view">
<?php
/**
* kt_loop_product_function hook
*
* @hooked kt_get_tool_wishlish - 1
* @hooked kt_get_tool_compare - 5
* @hooked kt_get_tool_quickview - 10
*/
do_action('kt_loop_product_function');
?>
</div>
<?php
示例9: WP_Query
$loop = new WP_Query($args);
if ($loop->have_posts()) {
while ($loop->have_posts()) {
$loop->the_post();
global $product;
?>
<!-- single-product start -->
<div class="col-lg-3 col-md-3">
<div class="single-product">
<div class="product-img">
<a href="<?php
echo get_permalink();
?>
">
<?php
echo woocommerce_get_product_thumbnail();
?>
<span class="box-over"></span>
</a>
<div class="new-item"><h6>NEW</h6></div>
<div class="price-box">
<?php
echo $product->get_price_html();
?>
</div>
<div class="actions-item">
<ul>
<?php
//woocommerce_template_loop_add_to_cart( $loop->post, $product );
?>
示例10: dt_woocommerce_template_loop_product_thumbnail
/**
* Loop shop product thumbnail.
*
*/
function dt_woocommerce_template_loop_product_thumbnail()
{
echo '<span class="rollover">' . woocommerce_get_product_thumbnail() . '</span>';
}
示例11: woocommerce_template_loop_product_thumbnail
function woocommerce_template_loop_product_thumbnail()
{
global $product;
if (class_exists('woocommerce')) {
echo '<span class="thumb">' . woocommerce_get_product_thumbnail();
echo '</span>';
}
}
示例12: cart_icon
/**
* Add to Cart for product listing
*/
public function cart_icon()
{
?>
<div class="product-thumb">
<?php
echo woocommerce_get_product_thumbnail();
wc_get_template('loop/add-to-cart.php');
?>
</div>
<a href="<?php
the_permalink();
?>
">
<?php
}
示例13: oxy_woocommerce_template_loop_product_thumbnail
function oxy_woocommerce_template_loop_product_thumbnail()
{
global $product;
$image_ids = $product->get_gallery_attachment_ids();
$back_image = array_shift($image_ids);
echo '<div class="product-image">';
echo '<div class="product-image-front">' . woocommerce_get_product_thumbnail() . '</div>';
if (null != $back_image) {
$back_image = wp_get_attachment_image_src($back_image, 'shop_catalog');
echo '<div class="product-image-back"><img src="' . $back_image[0] . '" alt=""/></div>';
}
echo '</div>';
}
示例14: product_thumbnail
/**
* WooCommerce Loop Product Thumbs
*
* @since 1.0
*
* @return string
*/
function product_thumbnail()
{
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
if (count($attachment_ids) == 0) {
echo '<span class="bb-product-thumbnails bb-thumbnail-single">';
} else {
echo '<span class="bb-product-thumbnails">';
}
echo woocommerce_get_product_thumbnail();
if (count($attachment_ids) > 0) {
echo wp_get_attachment_image($attachment_ids[0], 'shop_catalog');
}
echo '<span data-href="' . $product->get_permalink() . '" data-original-title="' . esc_attr__('Quick View', 'bigboom') . '" rel="tooltip" class="bb-quick-view"><i class="fa fa-search"></i></span>';
echo '</span>';
}
示例15: shop_isle_products_slider_on_single_page
/**
* Products slider on single page product
* @since 1.0.0
*/
function shop_isle_products_slider_on_single_page()
{
global $wp_customize;
$shop_isle_products_slider_single_hide = get_theme_mod('shop_isle_products_slider_single_hide');
if (isset($shop_isle_products_slider_single_hide) && $shop_isle_products_slider_single_hide != 1) {
echo '<hr class="divider-w">';
echo '<section class="module module-small-bottom aya">';
} elseif (isset($wp_customize)) {
echo '<hr class="divider-w">';
echo '<section class="module module-small-bottom shop_isle_hidden_if_not_customizer">';
}
if (isset($shop_isle_products_slider_single_hide) && $shop_isle_products_slider_single_hide != 1 || isset($wp_customize)) {
echo '<div class="container">';
$shop_isle_products_slider_title = get_theme_mod('shop_isle_products_slider_title', __('Exclusive products', 'shop-isle'));
$shop_isle_products_slider_subtitle = get_theme_mod('shop_isle_products_slider_subtitle', __('Special category of products', 'shop-isle'));
if (!empty($shop_isle_products_slider_title) || !empty($shop_isle_products_slider_subtitle)) {
echo '<div class="row">';
echo '<div class="col-sm-6 col-sm-offset-3">';
if (!empty($shop_isle_products_slider_title)) {
echo '<h2 class="module-title font-alt">' . $shop_isle_products_slider_title . '</h2>';
}
if (!empty($shop_isle_products_slider_subtitle)) {
echo '<div class="module-subtitle font-serif">' . $shop_isle_products_slider_subtitle . '</div>';
}
echo '</div>';
echo '</div><!-- .row -->';
}
$shop_isle_products_slider_category = get_theme_mod('shop_isle_products_slider_category');
if (!empty($shop_isle_products_slider_category) && $shop_isle_products_slider_category != '-') {
$shop_isle_products_slider_args = array('post_type' => 'product', 'posts_per_page' => 10, 'tax_query' => array(array('taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => $shop_isle_products_slider_category)));
$shop_isle_products_slider_loop = new WP_Query($shop_isle_products_slider_args);
if ($shop_isle_products_slider_loop->have_posts()) {
echo '<div class="row">';
echo '<div class="owl-carousel text-center" data-items="5" data-pagination="false" data-navigation="false">';
while ($shop_isle_products_slider_loop->have_posts()) {
$shop_isle_products_slider_loop->the_post();
echo '<div class="owl-item">';
echo '<div class="col-sm-12">';
echo '<div class="ex-product">';
echo '<a href="' . get_permalink() . '">' . woocommerce_get_product_thumbnail() . '</a>';
echo '<h4 class="shop-item-title font-alt"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>';
echo 'L12.00';
echo '</div>';
echo '</div>';
echo '</div>';
}
wp_reset_postdata();
echo '</div>';
echo '</div>';
}
} else {
$shop_isle_products_slider_args = array('post_type' => 'product', 'posts_per_page' => 10);
$shop_isle_products_slider_loop = new WP_Query($shop_isle_products_slider_args);
if ($shop_isle_products_slider_loop->have_posts()) {
echo '<div class="row">';
echo '<div class="owl-carousel text-center" data-items="5" data-pagination="false" data-navigation="false">';
while ($shop_isle_products_slider_loop->have_posts()) {
$shop_isle_products_slider_loop->the_post();
echo '<div class="owl-item">';
echo '<div class="col-sm-12">';
echo '<div class="ex-product">';
echo '<a href="' . get_permalink() . '">' . woocommerce_get_product_thumbnail() . '</a>';
echo '<h4 class="shop-item-title font-alt"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>';
echo 'L12.00';
echo '</div>';
echo '</div>';
echo '</div>';
}
wp_reset_postdata();
echo '</div>';
echo '</div>';
}
}
echo '</div>';
echo '</section>';
}
}