Skip to main content
Topic: Different Theme for Mobile? (Read 2813 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Different Theme for Mobile?

Hi I'm back again! XD

I've been working a lot to customize the site how we'd like it to appear on a computer as opposed to a mobile device. Now I'm curious how to modify things so that a mobile device will use a different theme which isn't so image inclusive? I tried adding this code to the index.php file but it sorta broke most of the site. We could try to submit things but we'd end up on a blank page and such.

Code: [Select]
<link rel="stylesheet" type="text/css" media="only screen and (max-device-width: 480px)" href="pathhere" />

The most ideal thing would be to have it recognize the mobile device and have it load in the social theme, which is already installed by default. I'm just not sure how to do that.
Last Edit: October 10, 2016, 03:07:29 pm by MangeCur

Re: Different Theme for Mobile?

Reply #1

First of all, welcome to ElkArte.

Second, if you need to create a custom theme, just installed another new theme based on default in theme settings page. From there, you may modify that new theme index.template.php file to include your css link code for default and mobile. Note that you may not directly find default css link code as it is being generated by SiteCombiner.class.php and is called via template_css(); in index.template.php. Thus, I think you should place your mobile css link code just before </head> to override default css.

Re: Different Theme for Mobile?

Reply #2

I'm sorry, can you word that another way? I already have custom themes. I just need a way for the default theme to recognize that they are on mobile and override the CSS with the custom CSS file I have. I'm not trying to change the default CSS, just call on something else instead. Is </head> in the index.template.php?

Re: Different Theme for Mobile?

Reply #3

Quote from: MangeCur – I'm sorry, can you word that another way?
Do I really have to?  ::)

How do you get this at the first place? If it is a copy of default, the earlier reply is applicable. If not, refer to that custom theme author(s).

Quote from: MangeCur – I just need a way for the default theme to recognize that they are on mobile and override the CSS with the custom CSS file I have.
It is not advisable to modify default theme as all its files may be replaced in a full upgrade. You should create and/or use your custom theme instead OR you can also create a custom.css that override default css for mobile view.

Quote from: MangeCur – I'm not trying to change the default CSS, just call on something else instead.
Understood and the earlier reply already answered that.

Quote from: MangeCur – Is </head> in the index.template.php?
Of course there is.  ;)

Re: Different Theme for Mobile?

Reply #4

@ahrasis Thanks! I posted my last reply when half asleep. My apologies! I'll give this a shot and let you know what I end up with. (: