本文整理汇总了PHP中woocommerce_related_products函数的典型用法代码示例。如果您正苦于以下问题:PHP woocommerce_related_products函数的具体用法?PHP woocommerce_related_products怎么用?PHP woocommerce_related_products使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woocommerce_related_products函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: woocommerce_output_related_products
function woocommerce_output_related_products()
{
$output = null;
ob_start();
woocommerce_related_products(array('columns' => 4, 'posts_per_page' => 4));
$content = ob_get_clean();
if ($content) {
$output .= $content;
}
echo '<div class="clear"></div>' . $output;
}
开发者ID:AntonioColeman,项目名称:Clairvoyant,代码行数:11,代码来源:functions.php
示例2: woocommerce_output_related_products
function woocommerce_output_related_products()
{
// Build the args
$args = array('posts_per_page' => 4, 'columns' => 4);
// Update settings
woocommerce_related_products($args);
}
开发者ID:Jhorton4,项目名称:Bohldfeys_Portfolio,代码行数:7,代码来源:woocommerce.php
示例3: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
global $woocommerce;
// Use default title as fallback
$title = '' === $instance['title'] ? __('Related Products', 'woocommerce') : $instance['title'];
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
// Setup product query
$query_args = array('post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => $instance['number'], 'orderby' => 'rand');
if ($instance['show_variations']) {
$query_args['meta_query'] = array(array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN'));
$query_args['post_parent'] = 0;
}
$query = new WP_Query($query_args);
if ($query->have_posts()) {
echo $args['before_widget'];
if ('' !== $title) {
echo $args['before_title'], $title, $args['after_title'];
}
?>
<ul class="product_list_widget_related">
<!-- <?php
//while ($query->have_posts()) : $query->the_post(); global $product;
?>
<li>
<a href="<?php
//the_permalink()
?>
">
<?php
//if ( has_post_thumbnail() ) {
// the_post_thumbnail('shop_thumbnail');
//} else {
// echo '<img src="'. woocommerce_placeholder_img_src() .'" alt="Placeholder" width="'.$woocommerce->get_image_size( 'shop_thumbnail_image_width' ).'" height="'.$woocommerce->get_image_size( 'shop_thumbnail_image_height' ).'" />';
//}
?>
<?php
//the_title()
?>
</a>
<?php
//echo $product->get_price_html()
?>
</li>
<?php
//endwhile;
?>
--> <?php
echo woocommerce_related_products(3, 1);
?>
</ul>
<?php
echo $args['after_widget'];
}
}
开发者ID:jaiweb,项目名称:ASP,代码行数:56,代码来源:asp-related_products.php
示例4: woocommerce_after_single_product_summary
/**
* This function changes the number of related products displayed on a single product page.
*/
function woocommerce_after_single_product_summary()
{
woocommerce_related_products(array('posts_per_page' => 3, 'columns' => 3));
}
开发者ID:silverhoopedge,项目名称:Simple-Shop-Theme,代码行数:7,代码来源:class-simple-shop.php
示例5: woocommerce_output_related_products
function woocommerce_output_related_products()
{
$related_posts = 4;
// 4 is default number
if (is_singular('product')) {
$page_layout = get_post_meta(get_the_ID(), '_et_pb_page_layout', true);
if ('et_full_width_page' !== $page_layout) {
$related_posts = 3;
// set to 3 if page has sidebar
}
}
$woocommerce_args = array('posts_per_page' => $related_posts, 'columns' => $related_posts);
woocommerce_related_products($woocommerce_args);
}
开发者ID:welearncodes,项目名称:traktern,代码行数:14,代码来源:functions.php
示例6: woocommerce_output_related_products
function woocommerce_output_related_products()
{
woocommerce_related_products(2, 2);
}
开发者ID:ridwanahmedkhan,项目名称:E-Commerce_Wordpress,代码行数:4,代码来源:woocommerce-template.php
示例7: avia_woocommerce_output_related_products
function avia_woocommerce_output_related_products()
{
global $avia_config;
echo "<div class='product_column product_column_" . $avia_config['shop_single_column'] . "'>";
woocommerce_related_products($avia_config['shop_single_column_items'], $avia_config['shop_single_column']);
// 4 products, 4 columns
echo "</div>";
}
开发者ID:eddiewilson,项目名称:new-ke,代码行数:8,代码来源:config.php
示例8: related_products
/**
* @param array $atts
* @return string
*/
public static function related_products($atts)
{
$atts = shortcode_atts(array('posts_per_page' => '2', 'columns' => '2', 'orderby' => 'rand', 'per_page' => ''), $atts);
if (!empty($atts['per_page'])) {
_deprecated_argument(__CLASS__ . '->' . __FUNCTION__, '2.1', __('Use $args["posts_per_page"] instead. Deprecated argument will be removed in WC 2.2.', 'woocommerce'));
$atts['posts_per_page'] = $atts['per_page'];
unset($atts['per_page']);
}
ob_start();
woocommerce_related_products($atts);
return ob_get_clean();
}
开发者ID:ayoayco,项目名称:upbeat,代码行数:16,代码来源:class-wc-shortcodes.php
示例9: woocommerce_output_related_products
function woocommerce_output_related_products()
{
woocommerce_related_products(8, 4);
// Display 3 products in rows of 3
}
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:5,代码来源:functions.php
示例10: woocommerce_output_related_products
/**
* Redefine woocommerce_output_related_products()
*/
function woocommerce_output_related_products()
{
woocommerce_related_products(array('columns' => 4, 'posts_per_page' => 4));
}
开发者ID:amitmula,项目名称:amitandaastha.in,代码行数:7,代码来源:woocommerce-integration.php
示例11: related_products
/**
* List related products.
* @param array $atts
* @return string
*/
public static function related_products($atts)
{
$atts = shortcode_atts(array('per_page' => '4', 'columns' => '4', 'orderby' => 'rand'), $atts);
ob_start();
// Rename arg
$atts['posts_per_page'] = absint($atts['per_page']);
woocommerce_related_products($atts);
return ob_get_clean();
}
开发者ID:seriusokhatsky,项目名称:woocommerce,代码行数:14,代码来源:class-wc-shortcodes.php
示例12: woocommerce_output_related_products
function woocommerce_output_related_products()
{
woocommerce_related_products(4, 4);
// Показать 4 товара а 4 колонки
}
开发者ID:kristinakarnitskaya,项目名称:larkyonline,代码行数:5,代码来源:functions.php
示例13: do_action
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
do_action('woocommerce_single_product_summary');
?>
</div><!-- .summary -->
<?php
/**
* woocommerce_after_single_product_summary hook
*
* @hooked woocommerce_output_product_data_tabs - 10
* @hooked woocommerce_output_related_products - 20
*/
do_action('woocommerce_after_single_product_summary');
?>
<div class="clearfix"></div>
<?php
woocommerce_related_products();
?>
</div><!-- #product-<?php
the_ID();
?>
-->
<?php
do_action('woocommerce_after_single_product');
开发者ID:Sibzsolutions,项目名称:Schiffrinpa,代码行数:31,代码来源:content-single-product.php
示例14: woocommerce_output_related_products
function woocommerce_output_related_products()
{
// Display related products in correct layout.
global $woo_options, $post;
$products_max = $woo_options['woocommerce_related_products_maximum'] + 2;
$products_cols = 4;
woocommerce_related_products($products_max, $products_cols);
}
开发者ID:brooksco,项目名称:jstich,代码行数:8,代码来源:theme-woocommerce.php
示例15: child_after_summary
static function child_after_summary()
{
woocommerce_related_products(array('posts_per_page' => 4, 'columns' => 4));
}
开发者ID:damiansu,项目名称:wordpress-es,代码行数:4,代码来源:Bw_woocommerce.php
示例16: related_products_shortcode
function related_products_shortcode($atts)
{
extract(shortcode_atts(array('per_page' => '2', 'columns' => '2', 'orderby' => 'rand'), $atts));
ob_start();
woocommerce_related_products($per_page, $columns, $orderby);
return ob_get_clean();
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:7,代码来源:class-wc-shortcodes.php
示例17: woocommerce_output_related_products
function woocommerce_output_related_products()
{
$args = array('posts_per_page' => 3, 'columns' => 3, 'orderby' => 'rand');
woocommerce_related_products($args);
// Display 3 products in rows of 3
}
开发者ID:naffan2014,项目名称:greenhomeland,代码行数:6,代码来源:woocommerce.php
示例18: woocommerce_output_related_products
function woocommerce_output_related_products()
{
$atts = array('posts_per_page' => '12', 'orderby' => 'rand');
woocommerce_related_products($atts);
}
开发者ID:quyendam2612,项目名称:quanao,代码行数:5,代码来源:functions.php
示例19: woocommerce_output_related_products
function woocommerce_output_related_products()
{
woocommerce_related_products(4, 4);
// 3 products, 3 columns
}
开发者ID:iplaydu,项目名称:Bob-Ellis-Shoes,代码行数:5,代码来源:theme-woocommerce.php
示例20: dt_woocommerce_output_related_products
function dt_woocommerce_output_related_products()
{
$page_layout = dttheme_option('woo', "product-layout");
$page_layout = !empty($page_layout) ? $page_layout : "content-full-width";
$related_products = $page_layout === "content-full-width" ? 4 : 2;
$output = "";
ob_start();
woocommerce_related_products(array('posts_per_page' => $related_products, 'columns' => $related_products));
// X products, X columns
$content = ob_get_clean();
if ($content) {
$content = str_replace('<h2>', '<h2 class="border-title">', $content);
$content = str_replace('</h2>', '<span></span></h2>', $content);
$output .= "<div class='related-products-container'>{$content}</div>";
}
echo $output;
}
开发者ID:PNW3DEV,项目名称:iesdb-v1,代码行数:17,代码来源:index.php
注:本文中的woocommerce_related_products函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论