Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #273800

    I found at Woothemes docs for displaying sale products this shortcode:

    array(
         'per_page' => '12',
         'columns' => '4',
         'orderby' => 'title',
         'order' => 'asc'
     )

    How about if I place this in Enfold Child functions.php or is this the wrong place? What I like is, having only one sale product on homepage, but per default, woocommerce has a four column layout for that activated. I need to overwrite this. So my question were to place this? In case, best will be as AVIA element, were I can select options!

    Thanks, Adrian

    #273803

    Update: There is a simple shortcode for placing inside post/page

    [sale_products per_page="1" columns="1"]

    but this doesn’t work as expected. Seems, that for sale_products the columns parameter doesn’t work. It shows up in the html code, but still as four columns, which makes the product very small.

    #273825

    Hi!

    You can try to insert this code into the functions.php file

    
    add_action('wp_head','avia_change_column_count');
    function avia_change_column_count(){
    global $avia_config, $woocommerce_loop;
    if(is_shop() || is_product_category()){
    $woocommerce_loop['columns'] = $avia_config['shop_overview_column'];
    }else{
    $avia_config['shop_overview_column'] = $woocommerce_loop['columns'];
    }
    remove_filter( 'loop_shop_columns', 'avia_woocommerce_loop_columns');
    add_filter( 'loop_shop_columns', 'avia_woocommerce_loop_columns_custom');
    }
    
    function avia_woocommerce_loop_columns_custom($count)
    {
    	global $avia_config;
    	if(is_shop() || is_product_category()) return $avia_config['shop_overview_column'];
    	return $count;
    }
    
    

    It will modify the standard function a bit and return the theme columns value (WooCommerce > Einstellungen > Produkte > “Column Count”) only on the shop and archive pages. The shortcodes should use the columns value you specified.

    Best regards,
    Peter

    #273827

    Thanks, danke, merci.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Sales products in AVIA’ is closed to new replies.