Created
May 14, 2013 09:19
-
-
Save stewartduffy/5574734 to your computer and use it in GitHub Desktop.
PODS CMS pods double where clause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Month Page Template | |
*/ | |
?> | |
<?php | |
$found_month = false; | |
global $pods; | |
$month_slug = pods_url_variable(-1); | |
$month = new Pod('month', $month_slug); | |
if( !empty( $month->data ) ) | |
{ | |
$found_month = true; | |
$month_name = $month->get_field('name'); | |
} | |
?> | |
<?php get_header(); ?> | |
<div id="content_frame"> | |
<h2><?php echo $month_name ?></h2> | |
<script type="text/javascript" language="javascript"> | |
var name = $("#content_frame h2").html(); | |
//alert(name); | |
$("#" + name).addClass("selected"); | |
</script> | |
<?php | |
$events = new Pod('event'); | |
//$team->findRecords('date ASC'); | |
$pagetitle = get_page_title(); | |
$where_clause = "DATE(t.date) >= CURDATE() && month.name = '$month_name'"; | |
$events->findRecords('date ASC', 25, $where_clause); | |
//get_page_title() | |
$total_members = $events->getTotalRows(); | |
?> | |
<?php if( $total_members>0 ) : ?> | |
<?php while ( $events->fetchRecord() ) : ?> | |
<?php | |
// set our variables | |
$event_name = $events->get_field('name'); | |
$event_photo = $events->get_field('poster'); | |
$slug = $events->get_field('slug'); | |
$date = $events->get_field('date'); | |
$excerpt = $events->get_field('excerpt'); | |
$with_bands = $events->get_field('with_bands'); | |
$promo_link = $events->get_field('link'); | |
$ticket_info = $events->get_field('ticket_info'); | |
$featured_event = $events->get_field('featured_event.name'); | |
// data cleanup | |
//$event_photo = $event_photo[0]['guid']; | |
$event_photo = wp_get_attachment_thumb_url($event_photo[0]['ID']); | |
$date = date("l jS", strtotime($date)); | |
?> | |
<div class="listing"> | |
<div class="poster"> | |
<?php if( !empty( $event_photo ) ) : ?> | |
<img src="<?php echo $event_photo; ?>" alt="Photo of <?php echo $event_name; ?>" /> | |
<?php endif ?> | |
</div> | |
<div class="info"> | |
<h5><?php echo $event_name; ?></h5> | |
<p class="gig_date"><?php echo $date; ?> - <?php echo $with_bands; ?></p> | |
<p><?php echo $excerpt; ?></p> | |
<p><?php echo $ticket_info; ?> | |
<?php if( $featured_event == 'yes' ) : ?> | |
|| <a href="<?php bloginfo("home"); ?>/gig/<?php echo $slug ?>">Click here for more info</a> | |
<?php endif ?> | |
</p> | |
</div> | |
</div> | |
<div class="hline"></div> | |
<?php endwhile ?> | |
<?php endif ?> | |
</div><!-- #content_frame --> | |
</div><!-- #right --> | |
</div><!-- #top_content --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment