Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
If your theme is responsive then this button should not exist as there’s no reason for it to. What problem are you trying to solve?
@anevins
Thanks for answering.
I want to make the button which can change from mobile View to Desktop View forcibly on mobile device.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Sorry I understand what you want, but it doesn’t make sense from a responsive point of view. A responsive website literally responds to the browser size and makes the content fit for that browser. It’s not like a switch.
Can you explain the problem you are trying to solve?
Use this as a button
<a href="mywebsite.php?show_desktop_mode=true">I want desktop mode!</a>
And insert following in header.php
<?php
session_start();
if($_GET['show_desktop_mode'] == 'true') {
$_SESSION['desktopmode'] = 'true';
}
?>
After doing that, you have to change the viewport according to the
Sessionvalue by doing this in <head>
<?php
if($_SESSION['desktopmode'] == 'true') {
/* DESKTOP MODE */
?>
<meta name="viewport" content="width=1024">
<?php
} else {
// DEFAULT
?>
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<?php
}
?>
@joy1212
Thank you for your reply.
I tried to insert the <?php session_start… Hearder.php file what you let me know
and deleted <meta name=”viewport”.. > code what is inside existing Hearder.php
and then I tried to insert mata viewport code what you told me.
Despite that, I made the widget button
An error what could not find mywebsite.php file has occured in the program
What’s should I do?