My website is not responsive on mobile devices

Often times even if we have setup our media queries correctly, the site still isn’t responsive to those queries. You need to set a viewport in your header.php to fix this. More often than not I find that this affects macs instead of PCs. but it’s still a good idea to add this no matter … Read more

detect screen width in functions

According to codex, wp_is_mobile(); is a boolean function that returns true if the user is visiting the website on a mobile device, so what you need is: if ( wp_is_mobile() ) { // Run this only for mobile visitors add_filter( ‘wp_nav_menu_items’, ‘B_function’, 10, 2 ); function B_function(/* add B */ ); } else { //If … Read more