• How to display only 4 products in the product page. it keeps adding and it is annoying. im using the short code to display the products.

    Thank you and best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WPClever

    (@wpclever)

    Hi @shenalorlof

    Please try this snippet (How to add custom code?):

    add_filter( 'woobt_show_items', 'woobt_show_maximum_items', 99 );
    function woobt_show_maximum_items( $items ) {
    	return array_slice( $items, 0, 4 );
    }
    Thread Starter shenalorlof

    (@shenalorlof)

    Dear supporter,

    Thank you it worked perfectly. Great support. How can limit items for 2 in mobile view?
    Desktop – 4
    Mobile 2

    Best Regards

    Plugin Author WPClever

    (@wpclever)

    Please change the previous snippet to:

    add_filter( 'woobt_show_items', 'woobt_show_maximum_items', 99 );
    function woobt_show_maximum_items( $items ) {
    	if ( wp_is_mobile() ) {
    		// if mobile detected
    		return array_slice( $items, 0, 2 );
    	} else {
    		return array_slice( $items, 0, 4 );
    	}
    }

    You can read more about wp_is_mobile here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘limit displaying products’ is closed to new replies.