File: /home/awaldron/_domains/pennhillscdc.org/wp-content/themes/phcdc/page-templates/home.php
<?php
/**
* Template Name: Home Page
*
* Template for displaying a blank page.
*
* @package understrap
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;
global $wpdb;
$db = new wpdb(DB_USER,DB_PASSWORD,DB_NAME,DB_HOST);
$events = $db->get_results("
SELECT e.*, d.*, c.cat_title, ct.adults, ct.kids
FROM event_date as d
LEFT JOIN events as e ON d.event_id=e.event_id
LEFT JOIN event_categories as c ON e.event_cat_id=c.event_cat_id
LEFT JOIN (SELECT r.event_date_id, SUM(r.reg_adults) as adults, SUM(r.reg_kids) as kids FROM event_registration as r WHERE r.reg_cancelled=0 GROUP BY r.event_date_id) AS ct ON ct.event_date_id=d.event_date_id
WHERE e.event_src='cdc' AND d.start > timestamp(current_date)
ORDER BY d.start ASC
LIMIT 0,4", ARRAY_A);
$announcements = get_posts( array(
'numberposts' => 3
));
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body class="">
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<div id="home-splash">
<div class="container">
<div class="row">
<div class="col-md-6 text-center">
</div>
<div class="col-md-6 splash-text">
<img src="/wp-content/themes/phcdc/img/onepennhills.png" class="onepennhills">
</div>
</div>
</div>
</div>
<div class="gray-bg div-padding">
<div class="container">
<div class="row">
<div class="col-md-10 offset-1 text-center">
<h1 class="green">Our Mission</h1>
<p>The Penn Hills Community Development Corporation (CDC) seeks to engage in activities that serve to unite the Penn Hills community and enhance the quality of life for its residents. In fulfilling this mission, we seek to actively promote inclusion of the entire ,community, including residents from all neighborhoods, as well as business owners and other community stakeholders.</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="calls-to-action">
<a class="cta" href="/upcoming-events">
<i class="fad fa-calendar-check"></i>
<h4>Attend a Meeting</h4>
<p>Join us at one of our meetings and see what we're all about!</p>
</a>
<a class="cta" href="/get-involved/individual-memberships/">
<i class="fad fa-user-plus"></i>
<h4>Become a Member</h4>
<p>Register as a member and manage your PHCDC membership online.</p>
</a>
<a class="cta" href="/get-involved/volunteer-database/">
<i class="fad fa-hands-helping"></i>
<h4>Volunteer</h4>
<p>Want to lend a hand? Register for our volunteer database.</p>
</a>
<a class="cta" href="https://members.pennhillscdc.org/donate" target="_blank">
<i class="fad fa-hands-usd"></i>
<h4>Make a Donation</h4>
<p>Support the work of the PHCDC by making a financial donation.</p>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="border-bottom div-padding">
<div class="container">
<div class="home-info">
<div class="home-events">
<div class="row">
<div class="col-sm-9">
<h2 class="green">Upcoming Events</h2>
<p>Click an event for full details and registration information.</p>
</div>
<div class="col-sm-3 text-right">
<a href="/upcoming-events/?src=eventkeeper" class="full-calendar"><i class="far fa-calendar-alt"></i> Full Calendar</a>
</div>
</div>
<div class="upcoming-events">
<?php
$ctr = 0;
//for ($i=0; $i < 10; $i++):
foreach( $events as $e):
//$e = $events[$i];
$event_full = false;
$reg_ct = $e['adults'] + $e['kids'];
$reg_avail = $e['seats'] - $reg_ct;
if ($e['seats'] > 0 && $reg_avail==0) {
$event_full = true;
}
if (!$event_full & $ctr < 4):
$ctr++;
?>
<a href="/upcoming-events/?src=eventkeeper" class="event event-row event-link">
<div class="event-header">
<div class="event-date">
<i class="far fa-calendar"></i>
<div class="event-month"><?=strtoupper(date('M',strtotime($e['start'])))?></div>
<div class="event-day"><?=date('j',strtotime($e['start']))?></div>
</div>
<div class="event-title">
<h5><?=$e['title']?></h5>
<p class="event-time">
<?=date('D h:ia',strtotime($e['start']))?> <!-- - <?=date('h:ia',strtotime($e['end']))?> -->
</p>
</div>
</div>
<div class="event-body">
<?=first_paragraph($e['description']);?>
</div>
</a>
<?php endif; endforeach; ?>
</div>
</div>
<div class="home-announcements">
<h2 class="green">Announcements</h2>
<p>Important messages from the PHCDC.</p>
<?php
//print_r($announcements);
foreach ($announcements as $ann) {
echo '<div class="home-announcement">';
echo '<span>'.date('m/d/Y', strtotime($ann->post_date)).'</span>';
echo '<a href="'.$ann->guid.'">'.$ann->post_title.'</a>';
echo '<div>'.$ann->post_excerpt.'</div>';
echo '</div>';
}
?>
</div>
</div>
</div>
</div>
<!--
<div class="modalbg" id="rising-alert">
<div class="modalbody">
<p><img src="https://pennhillsrising.com/assets/img/logo.png" style="max-width: 300px;" /></p>
<h2>The Penn Hills Community Census is now live!</h2>
<a href="https://pennhillsrising.com" target="_blank" class="big-button">Click here for full details >></a>
<a href="#" id="closeit"><i class="far fa-times-circle"></i> Close</a>
</div>
</div>
-->
<!--
<script type="text/javascript" >
jQuery(document).ready(function($) {
$('#lib-search-btn').click(function() {
$('#lib-search').submit();
});
$('#closeit').click( function(event) {
event.preventDefault();
$('body').removeClass('noscroll');
$('#rising-alert').fadeOut();
});
});
</script>
-->
<style>
.noscroll {
overflow: hidden;
}
.modalbg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0,0,0,0.5);
z-index: 99999999;
display: flex;
justify-content: center;
align-items: center;
}
.modalbody {
background: #26491E;
max-width: 600px;
min-width: 350px;
min-height: 200px;
padding: 30px;
text-align: center;
border-radius: 20px;
}
.modalbody h2 {
font-size: 28px;
color: #F6D348;
font-weight: 600;
}
#closeit {
color: #eb6868;
}
.big-button {
display: block;
background-color: #d08c15;
color: #fff;
text-align: center;
text-decoration: none;
padding: 15px;
font-size: 20px;
border-radius: 20px;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
margin: 10px 0 30px;
}
.big-button:hover {
background-color: #e6a535;
color: #fff;
text-decoration: none;
}
</style>
<?php get_template_part('loop-templates/content', 'blank'); ?>
<?php endwhile; // end of the loop. ?>
<?php wp_footer(); ?>
<?php get_footer(); ?>
</body>
</html>