本文整理汇总了PHP中woocommerce_get_product_schema函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_get_product_schema函数的具体用法?PHP woocommerce_get_product_schema怎么用?PHP woocommerce_get_product_schema使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_get_product_schema函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: thb_product_single
function thb_product_single($atts, $content = null)
{
extract(shortcode_atts(array('product_id' => ''), $atts));
global $post, $product, $woocommerce, $woocommerce_loop;
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'p' => $product_id);
$products = new WP_Query($args);
ob_start();
$catalog_mode = ot_get_option('shop_catalog_mode', 'off');
$shop_product_listing = ot_get_option('shop_product_listing', 'style1');
if ($products->have_posts()) {
while ($products->have_posts()) {
$products->the_post();
?>
<?php
$product = get_product($products->post->ID);
?>
<div class="products">
<article itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" <?php
post_class("post small-12 columns " . $shop_product_listing);
?>
>
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<?php
$image_html = "";
if (has_post_thumbnail()) {
$image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
}
?>
<?php
if ($shop_product_listing == 'style1') {
?>
<figure class="fresco">
<?php
do_action('thb_product_badge');
?>
<?php
echo $image_html;
?>
<div class="overlay"></div>
<div class="buttons">
<?php
echo thb_wishlist_button();
?>
<div class="post-title<?php
if ($catalog_mode == 'on') {
echo ' catalog-mode';
}
?>
">
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
</div>
<?php
if ($catalog_mode != 'on') {
?>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_price - 10
*/
do_action('woocommerce_after_shop_loop_item_title');
?>
<?php
do_action('woocommerce_after_shop_loop_item');
?>
<?php
}
?>
</div>
</figure>
<?php
} else {
if ($shop_product_listing == 'style2') {
?>
<figure class="fresco">
<?php
do_action('thb_product_badge');
?>
<a href="<?php
the_permalink();
?>
"><?php
echo $image_html;
?>
</a>
</figure>
//.........这里部分代码省略.........
开发者ID:ardiqghenatya,项目名称:web4,代码行数:101,代码来源:thb_product_single.php
示例2: do_action
/*
@version 3.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
global $product;
if (ThemexUser::isMember($post->post_author)) {
do_action('woocommerce_before_single_product');
if (post_password_required()) {
echo get_the_password_form();
return;
}
?>
<div itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" id="product-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<aside class="column fourcol">
<?php
do_action('woocommerce_before_single_product_summary');
$show = false;
ob_start();
?>
<div class="widget sidebar-widget">
开发者ID:TheTypoMaster,项目名称:wp_marketplace,代码行数:31,代码来源:content-single-product.php
示例3: do_action
<?php
/**
* woocommerce_before_single_product hook
*
* @hooked wc_print_notices - 10
*/
do_action( 'woocommerce_before_single_product' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="row product-detail-inner">
<div class="col-sm-5">
<?php
/**
* woocommerce_before_single_product_summary hook
*
* @hooked woocommerce_show_product_sale_flash - 10
* @hooked woocommerce_show_product_images - 20
*/
do_action( 'woocommerce_before_single_product_summary' );
?>
</div>
<div class="col-sm-7">
<div class="summary entry-summary">
开发者ID:kautzar,项目名称:drpp4,代码行数:29,代码来源:content-single-product.php
示例4: thb_product
function thb_product($atts, $content = null)
{
extract(shortcode_atts(array('product_sort' => 'best-sellers', 'carousel' => 'no', 'item_count' => '4', 'columns' => '4', 'cat' => '', 'product_ids' => ''), $atts));
global $post, $product, $woocommerce, $woocommerce_loop;
$args = array();
if ($product_sort == "latest-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
} else {
if ($product_sort == "featured-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count);
} else {
if ($product_sort == "top-rated") {
add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
$args['meta_query'] = $woocommerce->query->get_meta_query();
} else {
if ($product_sort == "sale-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_query' => array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric')));
} else {
if ($product_sort == "by-category") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $cat, 'posts_per_page' => $item_count);
} else {
if ($product_sort == "by-id") {
$product_id_array = explode(',', $product_ids);
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post__in' => $product_id_array);
} else {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value');
}
}
}
}
}
}
$products = new WP_Query($args);
$woocommerce_loop['columns'] = apply_filters('loop_shop_columns', $columns);
ob_start();
switch ($columns) {
case 2:
$col = 'medium-6';
break;
case 3:
$col = 'medium-4';
break;
case 4:
$col = 'medium-3';
break;
}
$catalog_mode = ot_get_option('shop_catalog_mode', 'off');
if ($products->have_posts()) {
?>
<?php
if ($carousel == "yes") {
?>
<div class="carousel-container">
<div class="carousel products owl row" data-columns="<?php
echo $columns;
?>
" data-navigation="true">
<?php
while ($products->have_posts()) {
$products->the_post();
?>
<?php
$product = wc_get_product($products->post->ID);
?>
<article itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" <?php
post_class("post small-6 {$col} columns");
?>
>
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<figure class="fresco">
<?php
$image_html = "";
if (thb_out_of_stock()) {
echo '<span class="badge out-of-stock">' . __('Out of Stock', THB_THEME_NAME) . '</span>';
} else {
if ($product->is_on_sale()) {
echo apply_filters('woocommerce_sale_flash', '<span class="badge onsale">' . __('Sale', THB_THEME_NAME) . '</span>', $post, $product);
}
}
if (has_post_thumbnail()) {
$image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
}
?>
<?php
echo $image_html;
?>
<div class="overlay">
//.........这里部分代码省略.........
开发者ID:ConceptHaus,项目名称:beckery,代码行数:101,代码来源:thb_product.php
示例5: load_products
function load_products()
{
$type = isset($_POST['type']) ? $_POST['type'] : "latest-products";
$footer_products_count = ot_get_option('footer_products_count', 6);
if ($type == "latest-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0);
} else {
if ($type == "featured-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'), array('key' => '_featured', 'value' => 'yes')), 'no_found_rows' => true, 'suppress_filters' => 0);
} else {
if ($type == "best-sellers") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value', 'meta_query' => array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'no_found_rows' => true, 'suppress_filters' => 0);
} else {
$category = get_term_by('id', $type, 'product_cat');
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $category->slug, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0);
}
}
}
$products = new WP_Query($args);
$catalog_mode = ot_get_option('shop_catalog_mode', 'off');
$shop_product_listing = ot_get_option('shop_product_listing', 'style1');
global $post;
if ($products->have_posts()) {
?>
<div class="carousel products no-padding owl row" data-columns="6" data-navigation="true" data-loop="true" data-bgcheck="false">
<?php
while ($products->have_posts()) {
$products->the_post();
?>
<?php
$product = get_product($products->post->ID);
?>
<article itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" <?php
post_class("post small-6 medium-4 large-2 columns product " . $shop_product_listing);
?>
>
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<?php
$image_html = "";
if (has_post_thumbnail()) {
$image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
}
?>
<?php
if ($shop_product_listing == 'style1') {
?>
<figure class="fresco">
<?php
do_action('thb_product_badge');
?>
<?php
echo $image_html;
?>
<div class="overlay"></div>
<div class="buttons">
<?php
echo thb_wishlist_button();
?>
<div class="post-title<?php
if ($catalog_mode == 'on') {
echo ' catalog-mode';
}
?>
">
<a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a>
</div>
<?php
if ($catalog_mode != 'on') {
?>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_price - 10
*/
do_action('woocommerce_after_shop_loop_item_title');
?>
<?php
do_action('woocommerce_after_shop_loop_item');
?>
<?php
}
?>
</div>
</figure>
<?php
//.........这里部分代码省略.........
开发者ID:ardiqghenatya,项目名称:web4,代码行数:101,代码来源:masonry-ajax.php
示例6: do_action
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
/**
* woocommerce_before_single_product hook
*
* @hooked wc_print_notices - 10
*/
do_action('woocommerce_before_single_product');
if (post_password_required()) {
echo get_the_password_form();
return;
}
echo beans_open_markup('woo_product_single_wrap', 'div', array('itemscope' => '', 'itemtype' => woocommerce_get_product_schema(), 'id' => 'product-' . get_the_ID(), 'class' => implode(' ', post_class())));
#TODO Double check
/**
* woocommerce_before_single_product_summary hook
*
* @hooked woocommerce_show_product_sale_flash - 10
* @hooked woocommerce_show_product_images - 20
*/
do_action('woocommerce_before_single_product_summary');
echo beans_open_markup('woo_product_single_summary', 'div', array('class' => 'summary entry-summary'));
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_rating - 10
* @hooked woocommerce_template_single_price - 10
开发者ID:ThemeButler,项目名称:woocommerce-overrides-for-beans,代码行数:31,代码来源:content-single-product.php
示例7: mango_woo_product
//.........这里部分代码省略.........
?>
<?php
if ($show_price == 'yes') {
?>
<?php
wc_get_template_part("loop/price");
?>
<?php
}
?>
</div><!-- End .product -->
<?php
}
}
}
?>
</div><!-- End .col-md-3 -->
<!--******************** QUICK VIEW START ******************************-->
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
global $product, $woocommerce;
$product_cats = $product->get_categories(' | ', '', '');
$attachment_ids = $product->get_gallery_attachment_ids();
?>
<div id="product-popup_<?php
echo the_ID();
?>
" class="overlay-popup mypopup mfp-hide">
<div itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" id="product-<?php
the_ID();
?>
" <?php
post_class("row");
?>
>
<?php
//do_action( 'woocommerce_before_single_product_summary' );
?>
<div class="col-md-6 col-sm-6">
<div class="images product-gallery-container">
<div class="product-top ">
<?php
woocommerce_show_product_sale_flash();
if (has_post_thumbnail()) {
$image_title = esc_attr(get_the_title(get_post_thumbnail_id()));
$image_caption = get_post(get_post_thumbnail_id())->post_excerpt;
$image_link = wp_get_attachment_url(get_post_thumbnail_id());
$image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'), array('title' => $image_title, 'alt' => $image_title));
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
//single-product //
$image = $image['0'];
$zoom_img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
$zoom_img = $zoom_img['0'];
echo apply_filters("woocommerce_single_product_image_html", sprintf('<img class="product-zoom" src="%s" data-zoom-image="%s" alt="%s"/>', $zoom_img, $zoom_img, $image_title), $post->ID);
} else {
echo apply_filters('woocommerce_single_product_image_html', sprintf('<img class="product-zoom" src="%s" data-zoom-image="%s" alt="%s" />', wc_placeholder_img_src(), wc_placeholder_img_src(), __('Placeholder', 'woocommerce')), $post->ID);
}
?>
</div>
开发者ID:nickkoskowski,项目名称:Work-Depot,代码行数:67,代码来源:shortcodes.php
示例8: get_the_password_form
/**
* woocommerce_before_single_product hook
*
* @hooked wc_print_notices - 10
*/
//do_action( 'woocommerce_before_single_product' );
if ( post_password_required() ) {
echo get_the_password_form();
return;
}
?>
<!-- Add class -->
<div itemscope itemtype="<?php echo woocommerce_get_product_schema(); ?>" id="product-<?php the_ID(); ?>" <?php $classes[] = "col-xs-12 col-sm-9 content-woocommerce" ; post_class( $classes ); ?>>
<!-- Título del producto -->
<?php $title_product = get_the_title(); ?>
<h1 class="page-title title-ventas title-product hidden-xs">
<span>
<?= $title_product; ?>
</span>
</h1>
<?php
/**
* woocommerce_before_single_product_summary hook
*
* @hooked woocommerce_show_product_sale_flash - 10
开发者ID:JDarkGreen,项目名称:wpmaletek,代码行数:31,代码来源:content-single-product.php
示例9: thb_grid
//.........这里部分代码省略.........
if ($style == "style2") {
switch ($i) {
case 1:
case 13:
$imagesize = array("720", "798");
$articlesize = 'small-12 medium-6';
break;
case 2:
case 4:
case 5:
case 6:
case 9:
case 8:
case 10:
case 11:
case 14:
case 15:
$imagesize = array("360", "400");
$articlesize = 'small-12 medium-3 grid-sizer';
break;
case 3:
case 7:
case 12:
$imagesize = array("360", "806");
$articlesize = 'small-12 medium-3';
break;
}
}
}
global $product, $post;
$catalog_mode = ot_get_option('shop_catalog_mode', 'off');
?>
<article itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" id="product-<?php
the_ID();
?>
" <?php
post_class($articlesize . ' columns post product item ' . $animation . '');
?>
>
<?php
if (has_post_thumbnail()) {
$thumbnail_id = get_post_thumbnail_id();
$image = wp_get_attachment_image_src($thumbnail_id, 'full');
$image_src = $image[0];
$image = aq_resize($image_src, $imagesize[0], $imagesize[1], true, true, true);
}
?>
<figure class="overlay-effect">
<img src="<?php
echo $image;
?>
" width="<?php
echo $imagesize[0];
?>
" height="<?php
echo $imagesize[1];
?>
" />
<div class="overlay">
<div class="table">
<div>
<div class="child post-title<?php
if ($catalog_mode == 'on') {
开发者ID:adampdarcy,项目名称:paola,代码行数:67,代码来源:thb_grid.php
示例10: thb_productgrid
function thb_productgrid($atts, $content = null)
{
extract(shortcode_atts(array('product_sort' => 'best-sellers', 'item_count' => '8', 'cat' => '', 'product_ids' => ''), $atts));
global $woocommerce, $woocommerce_loop;
if ($product_sort == "latest-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
} else {
if ($product_sort == "featured-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $item_count);
} else {
if ($product_sort == "top-rated") {
add_filter('posts_clauses', array($woocommerce->query, 'order_by_rating_post_clauses'));
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count);
$args['meta_query'] = $woocommerce->query->get_meta_query();
} else {
if ($product_sort == "sale-products") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_query' => array(array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC'), array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')));
} else {
if ($product_sort == "by-category") {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'product_cat' => $cat, 'posts_per_page' => $item_count);
} else {
if ($product_sort == "by-id") {
$product_id_array = explode(',', $product_ids);
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'post__in' => $product_id_array);
} else {
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $item_count, 'meta_key' => 'total_sales', 'orderby' => 'meta_value');
}
}
}
}
}
}
$products = new WP_Query($args);
$woocommerce_loop['columns'] = apply_filters('loop_shop_columns', '3');
ob_start();
$i = 1;
if ($products->have_posts()) {
?>
<div class="products row packery">
<?php
while ($products->have_posts()) {
$products->the_post();
?>
<?php
global $product, $post;
$font;
switch ($i) {
case 1:
case 13:
$imagesize = array("570", "600");
$font = 'large';
$articlesize = 'small-12 medium-6';
break;
case 2:
case 4:
case 5:
case 6:
case 9:
case 8:
case 10:
case 11:
case 14:
case 15:
$imagesize = array("270", "285");
$font = 'small';
$articlesize = 'small-12 medium-3';
break;
case 3:
case 7:
case 12:
$imagesize = array("270", "600");
$articlesize = 'small-12 medium-3';
$font = 'medium';
break;
}
?>
<article itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" id="product-<?php
the_ID();
?>
" <?php
post_class($articlesize . ' columns');
?>
>
<?php
if (has_post_thumbnail()) {
$image_id = get_post_thumbnail_id();
$image_link = wp_get_attachment_image_src($image_id, 'full');
$image = aq_resize($image_link[0], $imagesize[0], $imagesize[1], true, false);
}
?>
<figure>
<img src="<?php
echo $image[0];
?>
" width="<?php
//.........这里部分代码省略.........
开发者ID:primarydesign,项目名称:the-color-mint,代码行数:101,代码来源:shortcode.php
示例11: thb_footer_products
//.........这里部分代码省略.........
?>
data-type="featured-products"><?php
_e('Featured', THB_THEME_NAME);
?>
</a></li>
<?php
}
?>
</ul>
</aside>
<?php
}
?>
<?php
if (!empty($footer_products_sections)) {
?>
<?php
global $post;
$catalog_mode = ot_get_option('shop_catalog_mode', 'off');
$shop_product_listing = ot_get_option('shop_product_listing', 'style1');
$args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $footer_products_count, 'no_found_rows' => true, 'suppress_filters' => 0);
$products = new WP_Query($args);
?>
<div class="carousel-container">
<div class="carousel products no-padding owl row" data-columns="6" data-navigation="true" data-loop="true" data-bgcheck="false">
<?php
while ($products->have_posts()) {
$products->the_post();
?>
<?php
$product = get_product($products->post->ID);
?>
<article itemscope itemtype="<?php
echo woocommerce_get_product_schema();
?>
" <?php
post_class("post small-6 medium-4 large-2 columns product " . $shop_product_listing);
?>
>
<?php
do_action('woocommerce_before_shop_loop_item');
?>
<?php
$image_html = "";
if (has_post_thumbnail()) {
$image_html = wp_get_attachment_image(get_post_thumbnail_id(), 'shop_catalog');
}
?>
<?php
if ($shop_product_listing == 'style1') {
?>
<figure class="fresco">
<?php
do_action('thb_product_badge');
?>
<?php
echo $image_html;
?>
<div class="overlay"></div>
<div class="buttons">
<?php
echo thb_wishlist_button();
?>
开发者ID:ardiqghenatya,项目名称:web4,代码行数:67,代码来源:woocommerce.php
注:本文中的woocommerce_get_product_schema函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论