diff --git a/wp-content/themes/tn-2014/header.php b/wp-content/themes/tn-2014/header.php index 4c50e95..ac57997 100644 --- a/wp-content/themes/tn-2014/header.php +++ b/wp-content/themes/tn-2014/header.php @@ -3,6 +3,7 @@ + diff --git a/wp-content/themes/tn-2014/img/placeholder.gif b/wp-content/themes/tn-2014/img/placeholder.gif new file mode 100644 index 0000000..e72dd8b Binary files /dev/null and b/wp-content/themes/tn-2014/img/placeholder.gif differ diff --git a/wp-content/themes/tn-2014/js/app.js b/wp-content/themes/tn-2014/js/app.js index af70fed..c44eca7 100644 --- a/wp-content/themes/tn-2014/js/app.js +++ b/wp-content/themes/tn-2014/js/app.js @@ -12,7 +12,23 @@ var query_params = { custom_fields: custom_fields.join() }; -var list = '<% _.each(posts, function(post) { %>
  • " />
    <%= moment.unix(post.custom_fields._neuf_events_starttime).utc().format("YYYY-MM-DD HH:mm") %>
    <%= post.title %> (<%= post.custom_fields._neuf_events_price_regular %>/<%= post.custom_fields._neuf_events_price_member %>)
  • <% }); %>'; +function format_posts(posts) { + var html = ''; + for(var i=0; i< posts.length; i++) { + var post = posts[i]; + html += '
  • '; + if(post.thumbnail_images) { + html += '
    '; + } else { + var stylesheet_dir = jQuery("meta[name=x-stylesheet-directory]").attr('content'); + html += '
    '; + } + html += ''+ moment.unix(post.custom_fields._neuf_events_starttime).utc().format("YYYY-MM-DD HH:mm") +'
    '; + html += post.title +'('+ post.custom_fields._neuf_events_price_regular +')/'+ post.custom_fields._neuf_events_price_member +')
  • '; + } + return html; +} + jQuery(document).ready(function() { var $ = jQuery; $.getJSON( @@ -20,11 +36,9 @@ jQuery(document).ready(function() { query_params, function(data) { if(data && data.posts) { - // render template console.log(data); - var html = _.template(list, { - posts: data.posts.slice(0, 4)} - ); + // render template + var html = format_posts(data.posts.slice(0, 4)); $(".program-upcoming ul.program-list").html(html); } }