page.php 5.16 KB
<?php get_header(); ?>
<div id="page-content">
	<?php if (has_post_thumbnail( $post->ID ) ): ?>
	<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full-post-thumbnail' );
	$img_id = get_post_thumbnail_id($post->ID);
	$alt_text = get_post_meta($img_id , '_wp_attachment_image_alt', true);
	?>
	<div id="content-image">
		<img src="<?php echo $image[0]; ?>" width="908" height="453" alt="<?php echo $alt_text; ?>"/>
	</div>
	<?php if(get_field('transparency_content') != '') : ?>
		<div id="transparency-content">
			<?php the_field('transparency_content'); ?>
		</div>
	<?php endif; ?>
	<!-- If the content page has image -->
	<div id="has-image">
		<div class="siblings mobile-hide">
			<?php
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0&exclude=".$post->ID);
				$titlenamer = get_the_title($post->post_parent);
			}

			else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0&exclude=".$post->ID);
				$titlenamer = get_the_title($post->ID);
			}
			if ($children) { ?>
			<ul>
				<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
				<?php echo $children; ?>
			</ul>
			<?php } ?>
		</div>

		<div class="breadcrumbs">
			<?php if (function_exists('bcn_display')) {
				bcn_display();
			} ?>
		</div>
		<?php get_template_part('loop', 'page'); ?>
		<div class="siblings mobile-show">
			<?php
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
				$titlenamer = get_the_title($post->post_parent);
			}
			else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
				$titlenamer = get_the_title($post->ID);
			}
			if ($children) { ?>
			<ul>
				<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
				<?php echo $children; ?>
			</ul>
			<?php } ?>
		</div>
	</div>
<?php else : ?>
	<?php if(is_page('broker-private-page')){?>
	
	<?php global $userAccessManager;
		  global $wpdb;
	if (isset($userAccessManager)) {
		$iUserId = $user_ID;
		$is_no_bar=false;
		
		$aUserGroupsForUser = $wpdb->get_results( $wpdb->prepare( "
				SELECT wp_uam_accessgroup_to_object.object_id, wp_uam_accessgroup_to_object.object_type, wp_uam_accessgroup_to_object.group_id 
				FROM wp_uam_accessgroup_to_object INNER JOIN wp_uam_accessgroups ON wp_uam_accessgroup_to_object.group_id=wp_uam_accessgroups.ID
				WHERE wp_uam_accessgroups.groupname = '%s' AND wp_uam_accessgroup_to_object.object_id = %d
				ORDER BY wp_uam_accessgroup_to_object.object_id DESC
			",'rating.thecommonwell.ca/auth/authenticate', $iUserId ) );
      
		//error_log(print_r($aUserGroupsForUser,true));
		
	
		
		foreach ($aUserGroupsForUser as $oGroup) {
		//	  error_log($oGroup);
			if ($oGroup->group_id =="3"){
				$is_no_bar=true;
			}
		}
		
	}//end of  $userAccessManager 
	if(current_user_can('administrator')){$is_no_bar=true;} 
	if($is_no_bar == true){
	
	?>
	  <div class="promer-banner">
		  <div class="promer-text">GIVE “WAVE” A TRY</div>
		  <div class="promer-button"><a href="http://rating.thecommonwell.ca" class="rating-engine-link-button" target="_blank">COMMERCIAL RATING TOOL</a></div>
	  </div>
	<div id="no-image" class="promer-no-image">  
	<?php } else{?>  <div id="no-image"> <?php }
	
			}else{?>
	<!-- If there is no image for content page -->
	<div id="no-image">
	<?php }//end of broker-private-page?>
		<div class="siblings mobile-hide">
			<?php
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
				$titlenamer = get_the_title($post->post_parent);
			}
			else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
				$titlenamer = get_the_title($post->ID);
			}
			if ($children) { ?>
			<ul>
				<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
				<?php echo $children; ?>
			</ul>
			<?php } ?>
		</div>
		<div class="breadcrumbs">
			<?php if (function_exists('bcn_display')) {
				bcn_display();
			} ?>
		</div>
		<?php get_template_part('loop', 'page'); ?>
		<div class="siblings mobile-show">
			<?php
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
				$titlenamer = get_the_title($post->post_parent);
			}
			else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
				$titlenamer = get_the_title($post->ID);
			}
			if ($children) { ?>
			<ul>
				<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
				<?php echo $children; ?>
			</ul>
			<?php } ?>
		</div>
	</div>
<?php endif; ?>

</div>
<?php //get_sidebar(); ?>
<?php get_footer(); ?>