0

i m working on my own woocommerce theme and i am confused that how can i change the value of filter on screen resolution change.

add_filter( 'loop_shop_columns', 'products_per_col' );

function products_per_col() {
    return 4;
}

although i want to change the return value to '3' if user are visiting website using ipad (768px wide screen) and change the value to '2' if user are viewing from 600px wide device.

i am confused if is there any way to calculate screen width in php and perform this specific task. or if we can use some javascript or jquery then how can we just perform the above action.

so if there any way? kindly help me

thank you. all

  • 1
    See this question/answers on SO > http://stackoverflow.com/questions/1504459/getting-the-screen-resolution-using-php - The short answer is NO with PHP. You will need to use Javascript and/or a CSS solution. – Funk Forty Niner Jul 21 '13 at 01:37
  • Search first, this has been asked many times: http://stackoverflow.com/search?q=%5Bphp%5D+screen+size+is%3Aquestion – brasofilo Jul 21 '13 at 01:39

0 Answers0