Add end class to last item in list display of the jobs
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 19 Dec 2014 13:25:44 +0000 (08:25 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 19 Dec 2014 13:25:44 +0000 (08:25 -0500)
controllers/front.php
views/front/jobList.php

index 15d4068..5f023f3 100644 (file)
@@ -478,9 +478,12 @@ class glm_employment_front
             }
         }
         $jobs = get_posts($args);
+        $totalJobs = count($jobs);
         $current_url = add_query_arg($wp->query_string, '', home_url($wp->request));
+        $iterator = 1;
         foreach ($jobs as $job) {
             $custom = get_post_custom($job->ID);
+            $job->end                = false;
             $job->glm_jobs_startdate = $custom['glm_jobs_startdate'][0];
             $job->glm_jobs_enddate   = $custom['glm_jobs_enddate'][0];
             $job->glm_jobs_contact   = $custom['glm_jobs_contact'][0];
@@ -493,6 +496,10 @@ class glm_employment_front
             $job->href               = $current_url
                 . ((strpos($current_url, '?')) ? '&' : '?')
                 . "job=" . $job->ID;
+            if ($iterator == $totalJobs) {
+                $job->end = true;
+            }
+            ++$iterator;
         }
         include $this->frontViewDir . '/jobList.php';
         return;
index 71db430..1cd1cc4 100644 (file)
@@ -2,7 +2,7 @@
     <h1>List Jobs</h1>
     <div class="row">
         <?php if ($jobs): foreach($jobs as $job) :?>
-        <div class="small-12 medium-6 columns">
+        <div class="small-12 medium-6 columns<?php if ($job->end){ echo ' end';}?>">
             <h2><a href="<?php echo $job->href;?>"><?php echo $job->post_title;?></a></h2>
             <div><strong>Status: </strong><?php echo $job->glm_jobs_status;?></div>
             <div><a href="<?php echo $job->href;?>">Full Job Description</a></div>