page.php 2.48 KB
<?php
/*
 * Template Name: Broker  Pages
 */

global $user_ID;
wp_get_current_user();
if (!$user_ID) {
    auth_redirect();
}
?>
<?php get_header("brokerlanding");
global $wpdb;
?>
<div id="brokercontent">

    <?php if (has_post_thumbnail( $post->ID ) ): ?>
    <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
		<div class="header-image" id="header-image" style="background-image: url(<?php echo $image[0]; ?>);"></div>
        <?php 
            $mobile_image = get_field('mobile_header_image');
            if($mobile_image) {
                ?> 
                <div class="header-image" id="mobile-header-image" style="background-image: url(<?=  $mobile_image['url']; ?>);"></div>
                <?php
            }
        ?>
	<?php endif; ?>	

    <div id="page-content">
        <?php
            if (function_exists("clean_custom_menus")) {
                clean_custom_menus();
            }
        ?>
        <div class='inner-content-wrapper'>

            <?php 
                $sidebar_content = null;
            ?>

            <!-- CHECK IF THIS PAGE HAS A MENU -->
            <?php ob_start(); include_once 'templates/menu-sidebar.php'; $sidebar_content = ob_get_clean(); ?>

            <!-- CHECK IF THIS IS THE HOMEPAGE.. DISPLAY THE CONTACTS -->
            <?php if(is_front_page()) { ?>
                <?php ob_start(); include_once 'templates/broker_sidebar.php'; $sidebar_content .= ob_get_clean(); ?>
            <?php } ?>

            <!-- CHECK IF THIS PAGE HAS A SEARCH MODULE -->
            <?php ob_start(); include_once 'templates/search-sidebar.php'; $sidebar_content .= ob_get_clean(); ?>

            <?php if(!empty(trim($sidebar_content))) { $mobile_label = get_field('side_menu_mobile_label'); ?>
                <div class='sidebar-pullout'>
                    <span class='sidebar-title'><?= (!empty($mobile_label)) ? $mobile_label : __("Your Commonwell Team") ?></span>
                    <button class='pullout-btn'></button>
                </div>
                <div class='sidebar'><?= $sidebar_content ?></div>
            <?php } ?>

            <div class='article-wrapper <?= (!empty(trim($sidebar_content)))?'has-sidebar':'' ?>'>
                <?php get_breadcrumb() ?>
                <?php get_template_part('loop', 'single');?>
            </div>

            <div class='the-topper hide'>
                <a href='#'>Go to Top</a>
            </div>

        </div>
    </div>
</div>

<?php get_footer();?>