page.php
5.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?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(); ?>