Title: Custom mobile theme
Last modified: August 24, 2016

---

# Custom mobile theme

 *  Resolved [julianm](https://wordpress.org/support/users/julianm/)
 * (@julianm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/)
 * Hello! With the following filters, is there a way to specify a custom mobile 
   theme that is located outside the plugin folder, for example, inside the wp-content/
   themes/ folder?
 *     ```
       add_filter( 'jetpack_mobile_stylesheet', function( $stylesheet, $theme ) {
       	return 'custom/mobile';
       } );
   
       add_filter( 'jetpack_mobile_template', function ( $template, $theme ) {
       	return 'custom/mobile';
       	// if our mobile theme is a child theme, we should return the parent:
       	// return 'pub/myparenttheme-mobile';
       } );
       ```
   
 * [https://wordpress.org/plugins/jetpack/](https://wordpress.org/plugins/jetpack/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041716)
 * That should work, yes, as long as the string matches your theme’s stylesheet 
   or template value. For a parent theme, the template is the theme’s directory 
   name. For a child theme, the stylesheet is the child theme’s directory name.
 *  Thread Starter [julianm](https://wordpress.org/support/users/julianm/)
 * (@julianm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041806)
 * Hi Jeremy,
 * I’ve tried it, but it didn’t seem to work. It seems to default to a path relative
   to the plugin’s mobile theme folder. What would the string look like if I wanted
   to use the following path, for example?
 * `wp-content/themes/mobile/custom/styles.css`
 * Instead of this one:
 * `wp-content/plugins/jetpack/modules/minileven/theme/cutom/mobile/style.css`
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041808)
 * > What would the string look like if I wanted to use the following path, for 
   > example?
   > `wp-content/themes/mobile/custom/styles.css`
 * I’d suggest placing your theme in `wp-content/themes/mobile/style.css` instead,
   and the template and stylesheet values would then be `mobile`.
 *  Thread Starter [julianm](https://wordpress.org/support/users/julianm/)
 * (@julianm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041812)
 * Hi Jeremy. If I use just “mobile” as the return string, Jetpack tries to load
   it from here:
 * /wp-content/plugins/jetpack/modules/minileven/theme/mobile/style.css?ver=4.2.1
 *     ```
       add_filter( 'jetpack_mobile_stylesheet', 'mobile_theme_callback' );
   
       add_filter( 'jetpack_mobile_template', 'mobile_theme_callback' );
   
       function mobile_theme_callback(  ) {
       	return 'mobile';
       }
       ```
   
 * The only problem with this is that updating the plugin removes the theme directory.
 * This can be tested with the `jetpack_mobile_stylesheet` filter. If testing with`
   jetpack_mobile_template` filter, it produces a fatal error.
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041818)
 * Interesting. It might be a bug with how we define the filter.
 * Could you try to prefix things with `get_theme_root_uri` or `get_theme_root`,
   and let me know if one of these help?
    [https://codex.wordpress.org/Function_Reference/get_theme_root_uri](https://codex.wordpress.org/Function_Reference/get_theme_root_uri)
   [https://codex.wordpress.org/Function_Reference/get_theme_root](https://codex.wordpress.org/Function_Reference/get_theme_root)
 *  Thread Starter [julianm](https://wordpress.org/support/users/julianm/)
 * (@julianm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041820)
 * That didn’t seem to work. Here’s what happens using those two functions…
 *     ```
       add_filter( 'jetpack_mobile_stylesheet', function( $stylesheet, $theme ) {
       	$ss = get_theme_root() . 'mobile';
       	return $ss;
       } );
       ```
   
 * Adds the following:
 *     ```
       <link rel='stylesheet' id='style-css'  href='http://www.[DOMAIN].com/cms/wp-content/plugins/jetpack/modules/minileven/theme//home/[USER]/public_html/cms/wp-content/plugins/jetpack/modules/minileven/thememobile/style.css?ver=4.1.4' type='text/css' media='all' />
       ```
   
 *     ```
       add_filter( 'jetpack_mobile_stylesheet', function( $stylesheet, $theme ) {
       	$ss = get_theme_root_uri() . '/mobile';
       	return $ss;
       } );
       ```
   
 * Adds the following:
 *     ```
       <link rel='stylesheet' id='style-css'  href='http://www.[DOMAIN].com/cms/wp-content/plugins/jetpack/modules/minileven/theme/http%3A//www.[DOMAIN].com/cms/wp-content/plugins/jetpack/modules/minileven/theme/mobile/style.css?ver=4.1.4' type='text/css' media='all' />
       ```
   
 *  Plugin Author [Jeremy Herve](https://wordpress.org/support/users/jeherve/)
 * (@jeherve)
 * Jetpack Mechanic 🚀
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041822)
 * Thanks for giving it a try. That seems like a bug. I took note of it in this 
   GitHub issue:
    [https://github.com/Automattic/jetpack/issues/2061](https://github.com/Automattic/jetpack/issues/2061)
 * Feel free to follow our progress there. I’ll also post here when I have some 
   news.
 *  Thread Starter [julianm](https://wordpress.org/support/users/julianm/)
 * (@julianm)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041823)
 * Awesome, thank you! I’ve subscribed to the issue on GitHub also.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Custom mobile theme’ is closed to new replies.

 * ![](https://ps.w.org/jetpack/assets/icon.svg?rev=2819237)
 * [Jetpack - WP Security, Backup, Speed, & Growth](https://wordpress.org/plugins/jetpack/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jetpack/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jetpack/)
 * [Active Topics](https://wordpress.org/support/plugin/jetpack/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jetpack/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jetpack/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [julianm](https://wordpress.org/support/users/julianm/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/custom-mobile-theme-1/#post-6041823)
 * Status: resolved