How to include one class/instance without using global variables

I would like to add http://mobiledetect.net/ class to my template. Which is the best approach to dynamically use this class in every part(s) of my template? For the moment I just loaded the class in functions.php like this function devicecontrol() { require_once ‘_/inc/md/Mobile_Detect.php’; } add_action(‘wp_loaded’, ‘devicecontrol’, ‘1’); but to use it, I must first create … Read more

How to get a different mobile menu than desktop menu in the twentytwelve child theme

I would like to use a different menu for my mobile website than my desktop website. With different I mean the content not the layout. I just want to use the mobile menu of the twentytwelve theme. What I’ve done so far: In my child functions.php i’ve added the following code: register_nav_menus( array( ‘primary’ => … Read more

Using a Theme inside a Plugin directory

I am building a mobile friendly plugin and put the theme directory inside the plugin directory. If it’s a mobile browser, how can I redirect to the theme in the plugin directory? /wp-content/plugins/mobview/theme/ I’ve managed to use the following redirection: wp_redirect( plugins_url(‘/mobview/theme/index.php’) ); exit ; But am kind of lost in the directory redirect inside … Read more

What’s the earliest point I can get the queried object ID?

I’m writing a supplement plugin to WordPress Mobile Pack because I would like to use the default theme on pages that are assigned a certain page template. My plugin will only deal with the mobile switcher portion of that plugin, so the other components can be ignored (I think). Looking at the source for wpmp_switcher.php, … Read more