Support » Fixing WordPress » Switch theme depending on OS

  • pkclubpaul

    (@pkclubpaul)


    Hi,

    I’m looking for an plugin that recognize wich Operating System the visitor uses, i want my website to swich themes depending on wich device the visitor uses mobile, tablet or desktop?

    [ Signature deleted ]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Joy

    (@joyously)

    WP provides a PHP function https://developer.wordpress.org/reference/functions/wp_is_mobile/ but it is only a yes or no, not determining the attributes of the visitor’s device.
    It is not considered best prcatice to serve different content to different devices (although images and videos are exceptions), and so most themes handle all devices equally.
    Please read the details on that page. The important part is

    Additionally, care must be taken when using this function in a public theme. If your theme works differently for mobile devices and desktop devices, any page caching solution used MUST keep separate mobile/non-mobile buckets. Many caching solutions do not do this or charge for this feature. Even the most detailed read me file may not be able to adequately explain these details

    The thing you are asking is to determine on the server attributes that are only on the client, so you can execute specific code on the server to send the page to the client. Yes, there is a user agent string, but it is not reliable.

    Thread Starter pkclubpaul

    (@pkclubpaul)

    @joyously Thank you for you’re reply. It’s not reliable but if it not works the user get the default theme no problem; wich requirement or settings should i ask to get the job done?

    Thanks in advance!
    Take care stay strong and healthy COVID-19.

    Regards Paul

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Switch theme depending on OS’ is closed to new replies.