Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //initialize pods
- $types = new Pod('press_types');
- $press = new Pod('press');
- //Get press types sorted by id
- $types->findRecords('t.id',-1);
- while($types->fetchRecord()){
- $type_slug = $types->get_field('permalink');
- $type_name = $types->get_field('name');
- $type_ID = $types->get_field('id');
- ?>
- <h2 id="<?php echo $type_ID; ?>" class="press_type"><?php echo $type_name; ?></h2>
- <ul class="group">
- <?php
- //Now query for all press
- //belonging to this press_type slug
- //findRecords([sort by date descending], [return all results],
- //[where press_type matches])
- $count = 1;
- $press->findRecords('t.date DESC', -1, 'press_type.permalink LIKE "'. $type_slug .'"');
- while($press->fetchRecord()){
- $press_name = $press->get_field('name');
- $press_date = $press->get_field('date');
- $project_slug = $press->get_field('permalink');
- ?>
- <li class="<?php if ($count%3 == 1) { ?> first<?php } ?>"><a href="<?php echo $get_permalink; ?><?php echo $project_slug; ?>">
- <div class="press-image">
- <?php foreach ($press->get_field('tear_sheet') as $press_photo) {
- $thumbnail = wp_get_attachment_image_src( $press_photo[ID], 'medium' );
- echo "<img src='$thumbnail[0]' class='press-img' title='$press_name'/>";}?>
- </div>
- <h3><?php echo $press_name; ?> </h3> <span class="date"><?php echo $press_date; ?></span> </a></li>
- <?php
- }
- ?>
- <?php $count++; ?>
- </ul>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment