Last active
August 29, 2015 14:05
-
-
Save natejacobson/3bbe57b764435339670f to your computer and use it in GitHub Desktop.
Using the Syndicate plugin of WSUWP, place multiple feeds
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
(function ($) { | |
'use strict'; | |
function display_posts(feed, slug, element, title, count) { | |
if (element == 'main') { | |
$('main').append( | |
'<section class="row margin-right gutter feed json shortcode">' | |
+ '<div id="' + slug + '" class="column one ' + slug + '">' | |
+ '<h2>' + title + '</h2>' | |
+ '</div>' | |
+ '</section>' | |
); | |
} else { | |
$('main ' + element ).append( | |
'<div id="' + slug + '" class="' + slug + '">' | |
+ '<h2>' + title + '</h2>' | |
+ '</div>' | |
); | |
} | |
var i = 0; | |
$.each( feed, function( index, value ) { | |
if(index<count){ | |
var html = ''; | |
html += '<header>' | |
+ '<h3 class="article-title">' | |
+ '<a href="' | |
+ value.link | |
+ '">' | |
+ value.title | |
+ '</a>' | |
+ '</h3>'; | |
var date = $.datepicker.formatDate( 'MM d, yy', value.date ); | |
html += '<div class="article-meta">' | |
+ '<time>'+date+'</time>' | |
+ '</div>' | |
+ '</header>'; | |
html += '<div class="article-tease">' | |
+ value.excerpt | |
+ '</div>'; | |
+ '</article>'; | |
$('#'+slug).append(html); | |
} | |
}); | |
} | |
if ( $('body.home').length !== 0 ) { | |
display_posts(faculty_data,'faculty-feed','.column.one','Faculty News','3'); | |
display_posts(provost_data,'provost-feed','.column.one','Provost Announcements','3'); | |
display_posts(announcement_data,'announcements-feed','.column.one','University Announcements','15'); | |
} | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment