File: /home/heewonvps_17/drug-injury-lawyer.com/wp-content/themes/master/archive.php
<?php
/**
* The template for displaying Archive pages.
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Master Theme
*/
include 'Mobile_Detect.php';
global $is_mobile;
session_start();
$type = null;
$uri = null;
$detect = new Mobile_Detect();
if (isset($_GET['view'])) {
$type = $_GET['view'];
set_view_type($type);
}
if (isset($_SESSION['view_type'])) {
if ($_SESSION['view_type'] == 'mobile') {
$_SESSION['which_page'] = 'mobile';
} else if ($_SESSION['view_type'] == 'classic') {
$_SESSION['which_page'] = 'blog';
}
} else if (MobileDTS::is('android')) {
// User with a mobile device running Android OS
$_SESSION['which_page'] = 'mobile';
} else if ($detect->isTablet()) {
$_SESSION['which_page'] = 'blog';
} else if (MobileDTS::is('ios')) {
// User with a mobile device running iOS
$_SESSION['which_page'] = 'mobile';
} else if (MobileDTS::is('mobile')) {
// User with a mobile device (any, even 10 years old mobile phones)
$_SESSION['which_page'] = 'mobile';
} else {
// User with a desktop device
$_SESSION['which_page'] = 'blog';
}
get_header($_SESSION['which_page']); ?>
<div id="container">
<div id="content" role="main">
<?php
/* Queue the first post, that way we know
* what date we're dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
if ( have_posts() )
the_post();
?>
<h1 class="page-title">
<?php if ( is_day() ) : ?>
<?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ), get_the_date() ); ?>
<?php elseif ( is_month() ) : ?>
<?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ), get_the_date( 'F Y' ) ); ?>
<?php elseif ( is_year() ) : ?>
<?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ), get_the_date( 'Y' ) ); ?>
<?php else : ?>
<?php _e( 'Blog Archives', 'twentyten' ); ?>
<?php endif; ?>
</h1>
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
/* Run the loop for the archives page to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-archive.php and that will be used instead.
*/
get_template_part( 'loop', 'archive' );
?>
</div><!-- #content -->
</div><!-- #container -->
<?php if ($_SESSION['which_page'] != 'mobile') { get_sidebar('blog'); } ?>
<?php get_footer($_SESSION['which_page']); ?>