View Single Post
Old 09-29-2017, 08:41 AM  
maidenphoenix
Registered User
 
maidenphoenix's Avatar
 
Industry Role:
Join Date: Sep 2017
Posts: 80
How to limit the number of wordpress posts just for mobile ?

I am using WPscript and I want to limit the number of posts for the mobile version of the website.

So far I found this code and placed it in the functions.php file. It doesn't do anything, I think it should be placed elsewhere. Any ideas?
Code:
add_action('pre_get_posts','change_limit_mobile');

function change_limit_mobile($query){

    $new_limit = 10;

    $iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
    $android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
    $ipad = strpos($_SERVER['HTTP_USER_AGENT'],"iPad");
    $berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
    $ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");

    if (( $iphone || $android || $ipad || $ipod || $berry ) && $query->is_main_query()){
        set_query_var('posts_per_page',$new_limit);
    }
}
__________________
Is your step-mom hot? Watch this with her...
All girls love cumming ! Watch some amazing squirters in action
Buy and Sell adult traffic with Plugrush | Popcash | Trafficjunky
Earn $$$ with the best adult CPA network
Crackrevenue
maidenphoenix is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote