Include different PHP files depending on the screen size

Following is the way to include a different header on different screen sizes:

I have used 2 different headers:

  1. mobile_header.php
  2. desktop_header.php

 

<style type="text/css">
	@media only screen and (min-width: 768px) {
    /* tablets and desktop */
		div#mobile { display: none }
		
}

@media only screen and (max-width: 767px) {
    /* phones */
	div#desktop { display: none }
}

@media only screen and (max-width: 767px) and (orientation: portrait) {
    /* portrait phones */
	div#desktop { display: none }
}

</style>
<div id="mobile">
<?php


  include_once(mobile_header.php');

?>
</div>
<div id="desktop">
<?php 
{
  include_once(desktop_header.php');
}

?>

</div>

 

One thought on “Include different PHP files depending on the screen size

  1. Pingback: vape mod

Leave a Reply