»WordPress»WordPress loads different themes according to different UA
Several lines of code realize automatic switching of WordPress theme according to UA
preface
Some time ago, if some friends were quick eyed, they must have seen that the theme of Yunluo's website has just changed.Of course, the actual situation is that Cloud Cloud is installing a new foreign theme while debugging and testing, but sometimes when debugging a new theme, it will affect the operation of the current website. So today, consider using the method of switching themes according to ua.
describe
In fact, the working principle is very simple. It is to check the ua of the current browser. If the ua meets the requirements, it will switch to the theme you use. Otherwise, it will switch to another theme. The browser used here can be Firefox or Chrome browser. Using browser plug-ins can easily modify the ua of the browser. Cloud uses Firefox browser here,For example, the firefox ua in Yunluo is below