| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/winee/wp-content/themes/wineroad_OLD/ |
Upload File : |
<?php
/**
* The template used for displaying page content
*/
$body_classes = array();
$categories = get_the_category();
if( isset( $categories ) ){
foreach($categories as $category) {
array_push($body_classes, $category->category_nicename);
}
}
$has_sub_pages = false;
$parent_page_id = wp_get_post_parent_id(get_the_ID());
$third_level_nav = false;
if( count( get_post_ancestors(get_the_ID()) ) >= 2 ){
$third_level_nav = true;
}
if(count( get_pages( "child_of=".$parent_page_id ) ) > 0){
$has_sub_pages = true;
}
?>
<div class="small-12 medium-8 large-9 columns">
<?php
$page_title = get_the_title();
$temp_title = get_field('title');
if( !empty( $temp_title ) ){
$page_title = get_field('title');
}
?>
<?php if( in_array("lodging", $body_classes ) || in_array("winery", $body_classes ) ){ ?>
<h1 class="page-title"><?php echo $page_title; ?></h1>
<?php } ?>
<?php if( $third_level_nav && $has_sub_pages ) : ?>
<div class="row">
<div class="small-12 columns third-level-navigation">
<ul>
<?php
wp_list_pages( array(
'child_of' => $parent_page_id,
'title_li' => '',
'depth' => 1
) );
?>
</ul>
</div>
</div>
<?php endif; ?>
<?php
the_content();
if( get_post_type() == 'post' ){
$id = get_the_ID();
$url = get_post_meta($id,'url',true);
$cc_types = preg_replace('/,/', ', ', get_post_meta($id,'cc_types',true));
$amenities = preg_replace('/,/', ', ', get_post_meta($id,'amenities',true));
$food_types = preg_replace('/,/', ', ', get_post_meta($id,'food_types',true));
$wine_types = preg_replace('/,/', ', ', get_post_meta($id,'wine_types',true));
$lodging_types = preg_replace('/,/', ', ', get_post_meta($id,'lodging_types',true));
$other_amenities = preg_replace('/,/', ', ', get_post_meta($id,'other_amenities',true));
$video_embed = preg_replace('/,/', ', ', get_post_meta($id,'video_embed',true));
$email_address = preg_replace('/,/', ', ', get_post_meta($id,'email_address',true));
$visit_website_url = '';
if( preg_match("/^http:\/\//", $url) ){
$visit_website_url = $url;
} else if($url) {
$visit_website_url = "http://$url";
}
if( $food_types ){ echo "<p>Food Types: $food_types</p>"; }
if( $wine_types ){ echo "<p>Wine Types: $wine_types</p>"; }
if( $lodging_types ){ echo "<p>Lodging Types: $lodging_types</p>"; }
if( $cc_types ){ echo "<p>Credit Cards Accepted: $cc_types</p>"; }
if( $amenities ){ echo "<p>Facilities: $amenities</p>"; }
if( $other_amenities ){ echo "<p>Other amenities: $other_amenities</p>"; }
if( $visit_website_url ){ echo "<p>Visit our website: <a href='$visit_website_url' target='_blank'>$visit_website_url</a></p>"; }
if( $email_address ){ echo "<p>Email: <a href='mailto:$email_address'>$email_address</a></p>"; }
if( $video_embed ){ echo "<div class='flex-video'>$video_embed</div>"; }
}
$post_category = get_field('post_category');
$post_format = get_field('display_style');
if( $post_category ):
?>
<div class="row">
<div class="small-12 columns">
<?php
if($post_format == 'multi_column' || $post_format == NULL):
$posts_for_category = get_posts( array(
'posts_per_page' => -1,
'offset' => 1,
'category' => $post_category,
'orderby' => 'post_date',
'post_type' => 'post',
'post_status' => 'publish'
) );
$visit_page = false;
$visit_categories = [51,52,53,54,55,56,57,58,69];
if( in_array($post_category, $visit_categories)){
$visit_page = true;
}
foreach ( $posts_for_category as $post ) :
echo '<hr>';
$post_id = get_the_ID();
$page = get_post($post_id);
$address = "";
$google_maps_url = "https://www.google.ca/maps/place/";
if($page->address){
$address .= $page->address;
$google_maps_url .= $page->address . " ";
}
if($page->city || $page->state || $page->zip){
$address .= "<br />";
}
if($page->city){
$address .= $page->city;
$google_maps_url .= $page->city . " ";
}
if($page->state || $page->zip){
$address .= ", ";
}
if($page->state){
$address .= $page->state;
$google_maps_url .= $page->state . " ";
}
if($page->zip){
$address .= $page->zip;
$google_maps_url .= $page->zip;
}
// New Release
$contact_email = get_post_meta($post_id,'contact_email',true);
$contact_person = get_post_meta($post_id,'contact_person',true);
$contact_phone = get_post_meta($post_id,'contact_phone',true);
$contact_email_formatted = "<a href='mailto:$contact_email'>$contact_email</a>";
if($contact_email && $contact_person){
$contact_email_formatted = "<a href='mailto:$contact_email'>$contact_person</a>";
$contact_person = '';
}
$special_url = get_post_meta($post_id,'special_url',true);
$direct_url = get_post_meta($post_id,'direct_url',true);
$release = get_post_meta($post_id,'release',true);
$release2 = get_post_meta($post_id,'release2',true);
$release_title = "<h6>$release</h6>";
if($release && $release2){
$release_title = "<h6>$release<br />$release2</h6>";
}
// Wine Awards
$award = trim( get_post_meta($post_id,'award',true) );
$wine = trim( get_post_meta($post_id,'wine',true) );
$formatted_award = "<p>$wine, $award</p>";
// Visit images
$image = get_post_meta($post_id, 'image',true);
$full_image_path = '';
$file_exists = false;
// Employment opportunity
$establishment_name = get_post_meta($post_id,'company',true);
if(!$establishment_name){ $establishment_name = get_post_meta($post_id,'establishment_name',true); }
$wages = get_post_meta($post_id,'wages',true);
$job_category = get_post_meta($post_id,'job_category',true);
$responsibilities = get_post_meta($post_id,'responsibilities',true);
$work_hours = get_post_meta($post_id,'work_hours',true);
if( preg_match("/^\d+$/", $image) ){
$full_image_path = "/wp-content/uploads/wr-import/$image.jpg";
} else{
$full_image_path = $image;
}
if(strlen($full_image_path) && file_exists("." . $full_image_path)){
$file_exists = true;
}
$formatted_url = '';
if( preg_match("/^http:\/\//", $page->url) ){
$formatted_url = $page->url;
} else if($page->url) {
$formatted_url = "http://$page->url";
}
$formatted_direct_url = '';
if( preg_match("/^http:\/\//", $direct_url) ){
$formatted_direct_url = $direct_url;
} else if($direct_url) {
$formatted_direct_url = "http://$direct_url";
}
$formatted_special_url = '';
if( preg_match("/^http:\/\//", $special_url) ){
$formatted_special_url = $special_url;
} else if($special_url) {
$formatted_special_url = "http://$special_url";
}
$content = $page->post_content;
$title = $page->post_title;
if($establishment_name && $job_category){
if(!(in_category('37'))){
$title = "$page->post_title - $establishment_name";
}
} else if($establishment_name){
if(!(in_category('37'))){
$title = $establishment_name;
}
}
$contact_details = "<ul>";
if($file_exists && !$visit_page){
$contact_details = "<ul class=\"contact-details-list-wrapper\">";
}
if($contact_person){ $contact_details .= "\t<li>$contact_person</li>\n"; }
//if($contact_email){ $contact_details .= "\t<li>$contact_email_formatted</li>\n"; }
if(!(in_category('37'))){
//if you are not viewing something in the LODGING SPECIAL cat, show email
if($contact_email){ $contact_details .= "\t<li>$contact_email_formatted</li>\n"; }
}
if($contact_phone){ $contact_details .= "\t<li><a href='tel:$contact_phone'>$contact_phone</a></li>\n"; }
if($direct_url){ $contact_details .= "\t<li><a href='$formatted_direct_url' target='_blank'>$formatted_direct_url</a></li>\n"; }
if($page->phone){ $contact_details .= "\t<li><a href='tel:$page->phone'>$page->phone</a></li>\n"; }
if($address){ $contact_details .= "\t<li><a href='$google_maps_url' target='_blank'>$address</a></li>\n"; }
if($formatted_url){ $contact_details .= "\t<li><a href='$formatted_url' target='_blank'>Visit Our Website</a></li>\n"; }
if(in_category('37')){
//if you are viewing something in the LODGING SPECIAL cat, show VISIT OUR WEBSITE as the link text
if($formatted_special_url){ $contact_details .= "\t<li><a href='$formatted_special_url' target='_blank'>Visit Our Website</a></li>\n"; }
}else{
if($formatted_special_url){ $contact_details .= "\t<li><a href='$formatted_special_url' target='_blank'>$formatted_special_url</a></li>\n"; }
}
$contact_details .= "</ul>";
$custom_image = get_post_meta($post_id,'image',true);
if( $post_category == 69 && !empty( $custom_image) ):
?>
<article class="row post-listing multi-column-display">
<div class="small-12 medium-4 columns">
<img src="<?php echo esc_url_raw( $custom_image ); ?>" />
</div>
<div class="small-12 medium-8 columns">
<h4><?php echo $title; ?></h4>
<div class="post-listing-contact-details">
<?php echo $contact_details; ?>
</div>
<?php echo "<p>$content</p>"; ?>
</div><!-- / small-12 medium-8 columns -->
</article><!-- / row -->
<?php else: ?>
<article class="row post-listing multi-column-display">
<div class="small-12 columns">
<h4><?php
if(!(in_category('37'))){
echo $title;
}else{
echo $establishment_name;
}
?></h4>
</div>
<div class="small-12 <?php if($file_exists && !$visit_page){ echo "medium-6"; } else { echo "medium-4"; } ?> columns post-listing-contact-details">
<?php echo $contact_details; ?>
<?php if($file_exists && !$visit_page){ echo "<div class='contact-details-image-wrapper'><img src='$full_image_path' /></div>"; } ?>
</div><!-- / small-12 medium-4 columns -->
<div class="small-12 <?php if($file_exists && !$visit_page){ echo "medium-6"; } else { echo "medium-8"; } ?> columns">
<?php
if($release || $release2){ echo $release_title; }
if($award || $wine){
echo "<h6>$content</h6>";
echo $formatted_award;
} else {
if(in_category('37')){
//if content is for a Lodging Special, limit it to 50 words
echo $title;
echo "<p>". limit_text($content, 50) . "</p>";
}else{
//any other category, show all the content regardless of length
echo "<p>$content</p>";
}
;
if($wages){ echo "<p>Wages: $wages</p>"; }
if($job_category){ echo "<p>Job category: $job_category</p>"; }
if($responsibilities){ echo "<p>Roles & Responsibilities: $responsibilities</p>"; }
if($work_hours){ echo "<p>Work hours: $work_hours</p>"; }
}
if($job_category){
echo "<p>Posting date: " . get_the_date('m/d/Y') . "</p>";
}
?>
</div><!-- / small-12 medium-8 columns -->
</article><!-- / row -->
<?php
endif;
wp_reset_postdata();
endforeach;
else:
$posts_for_category = get_posts( array(
'posts_per_page' => -1,
'offset' => 1,
'category' => $post_category,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish'
) );
echo "<ul class='list-post-titles'>";
foreach ( $posts_for_category as $post ){
$post_id = get_the_ID();
$page = get_post($post_id);
$permalink = get_permalink( $post_id );
$date = get_the_date();
echo "<li><a href='$permalink'>$page->post_title</a> - " . get_the_date('m/d/Y') . "</li>";
wp_reset_postdata();
}
echo "</ul>";
endif;
?>
</div><!-- / small-12 columns -->
</div><!-- / row -->
<?php endif ?>
</div><!-- / small-12 medium-9 columns -->
<?php
if( get_post_type() == 'post' ){
require_once(get_template_directory() . '/location_details.php');
} else {
require_once(get_template_directory() . '/contentblocks.php');
}
?>