Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions assets/less/blog.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.blog {
.news {
.local, .remote {
.make-md-column(6);

article {
h2 {
font-size: 20px;
margin-bottom: 0;
}
h4 {
margin-top: 0;
}
}
}
&.no-local {
.local {
display: none;
}
.remote {
.make-md-column(12);
}
}
}
}
1 change: 1 addition & 0 deletions assets/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
@import 'events.less';
@import 'rte.less';
@import 'page.less';
@import 'blog.less';
@import 'forms.less';
1 change: 1 addition & 0 deletions assets/less/page.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ article {
}
h2 {
margin-top: 0;
font-size: 20px;
}
// Add .com to "Bernie Sanders" link for more clarity
p:last-child {
Expand Down
44 changes: 43 additions & 1 deletion home.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,57 @@
get_header();

use SandersForPresident\Wordpress\Services\News\NewsFeedService;
use SandersForPresident\Wordpress\Services\News\RemoteNewsFeedService;

$newsFeedService = new NewsFeedService();
$news = $newsFeedService->getNewsFeed();
$remoteNewsFeedService = new RemoteNewsFeedService();
$localNews = $newsFeedService->getLocalNewsFeed();
$remoteNews = $remoteNewsFeedService->getFeed();
?>
<div class="container blog list">
<div class="page-container">
<div class="page-title">
<h2>News</h2>
</div>

<div class="news <?php if (empty($localNews)) { echo 'no-local'; } ?>">

<div class="local">
<h2>Local News</h2>
<?php foreach ($localNews as $item): ?>
<article>
<h2>
<a href="<?php echo $item->getLink(); ?>">
<?php echo $item->getTitle(); ?>
</a>
</h2>
<h4><?php echo $item->getFormattedDate(); ?></h4>
<div class="rte">
<?php echo $item->getContent(); ?>
</div>
</article>
<?php endforeach; ?>
</div>

<div class="remote">
<h2>Campaign News</h2>
<?php foreach ($remoteNews as $item): ?>
<article>
<h2>
<a href="<?php echo $item->getLink(); ?>">
<?php echo $item->getTitle(); ?>
</a>
</h2>
<h4><?php echo $item->getFormattedDate(); ?></h4>
<div class="rte">
<?php echo $item->getContent(); ?>
</div>
</article>
<?php endforeach; ?>
</div>
</div>

<!--
<?php foreach ($news as $item) : ?>
<article<?php if ($item->isRemote()) : ?> class="official"<?php endif; ?>>
<?php if ($item->isRemote()) : ?><h5>Campaign News</h5><?php endif; ?>
Expand All @@ -26,6 +67,7 @@
</div>
</article>
<?php endforeach; ?>
-->
</div>
</div>
<?php get_footer(); ?>
2 changes: 1 addition & 1 deletion lib/services/news/news_feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct() {
* Fetches the local news feed.
* Note: currently MUST utilize The Loop
*/
private function getLocalNewsFeed() {
public function getLocalNewsFeed() {
global $post;
$articles = array();
while (have_posts()) {
Expand Down