PHP mobile redirect Endless loop

Disable the plugin at all and in your function.php add add_action(‘init’, ‘my_mobile_redirect’); function get_first_url_subdir() { return str_replace( str_replace( array(‘http://’, ‘https://’), ”, get_site_url() ), ”, $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’]); } function redirect_mobile_with_cookie() { $cookiename=”redirect_mobile_is_a_mobile_device”; if ( isset($_COOKIE[$cookiename]) && ($_COOKIE[$cookiename] == ‘yes’) && strpos(get_first_url_subdir(), ‘/mobile’) !== 0) return true; return false; } function my_mobile_redirect(){ if ( redirect_mobile_with_cookie() ) … Read more

Mobile version and URL Rewrite

You can change the options siteurl and home. add_action(‘after_setup_theme’, ‘maybe_mobile_url’); function maybe_mobile_url() { if ( wp_is_mobile() ) { add_filter(‘option_siteurl’, ‘add_mobile_url’ ); add_filter(‘option_home’, ‘add_mobile_url’ ); } } function add_mobile_url ($url) { return $url . ‘/mobile’; } But, I think, that if you define WP_SITEURL and/or WP_HOME in config.php it will fail, and you will have to … Read more

Conditional config WP_HOME/WP_SITEURL does not update bloginfo(‘template_url’)?

Found the solution… the problem was due to placement of the conditional statement in the wp-config.php file. It needed to be inserted before the require_once(ABSPATH . ‘wp-settings.php’); line near the bottom of the default config file, otherwise the constants are already defined and cannot be redefined. So final section of the wp-config.php file now looks … Read more

CSS is not loaded on mobile devices

After investigation and talking with some sysadmin friends, it happened that there was a .htaccess with rewrite rules for mobile devices in the root of WordPress, in wp-content and in all folders in themes and plugins. I removed all the .htaccess, refresh the root .htaccess with only wordpress needed stuff and everything is good now. … Read more

WordPress Menu Exchange for Mobile Layout

There isn’t an is_mobile() function to my knowledge. WordPress uses a wp_is_mobile() which is probably what you’re looking for. So it should look like this: <?php if ( wp_is_mobile() ) { wp_nav_menu( array(‘menu’ => ‘mobile’ ) ); } else { wp_nav_menu( array(‘menu’ => ‘primary’ ) ); }; ?> EDIT After reviewing your question further it … Read more

Create theme for mobile phones and tablets only?

It’s doable with a user agent string “sniffer”. Take a look at this project: http://mobiledetect.net Mind you, this approach can be troublesome as most modern browsers can ‘fake’ their user agent strings. Also, this approach doesn’t work to well with caching systems. I’ve implemented it successfully on a project I worked on, and I know … Read more

Updating From Mobile App – Exposing Site to Hacking

The safest way to manage content from outside of the WordPress dashboard, and make use of the WordPress roles and capabilities model, is via XML-RPC. The basic methods built in to WordPress XML-RPC allow you to add, edit and delete posts and media, and restrict the ability to do so based on WordPress user permissions. … Read more

Contact form submit, having to click twice

It sounds like a ‘classic rollover effect bug’ to me: if you trigger a visual effect on any link (or ‘button’) either with jQuery or JavaScript, users on touch devices may be forced to click twice: “iPad/iPhone hover problem causes the user to double click a link“ I suggest you either try to replace the … Read more

Limit posts when visited with mobile devices

Original answer: You could instead try using MobileESP by downloading https://raw.githubusercontent.com/ahand/mobileesp/master/PHP/mdetect.php to your theme directory and then: function change_limit_mobile( $query ) { if ( $query->is_main_query() ) { require get_stylesheet_directory() . ‘/mdetect.php’; $mdetect = new uagent_info; if ( $mdetect->DetectMobileLong() ) { set_query_var( ‘posts_per_page’, 10 ); } } } Update: the simplest thing is to use wp_is_mobile() … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)