diff --git a/start.php b/start.php index 6e76fdc..6a977a0 100644 --- a/start.php +++ b/start.php @@ -44,6 +44,11 @@ function community_theme_init() { ])); elgg_register_plugin_hook_handler('action', 'login', 'community_theme_login_action'); + + elgg_register_page_handler('blog-feed.js', function () { + echo elgg_view_resource('blog-feed.js'); + return true; + }); } function community_theme_login_action() { diff --git a/views/default/resources/blog-feed.js.php b/views/default/resources/blog-feed.js.php new file mode 100644 index 0000000..c719fec --- /dev/null +++ b/views/default/resources/blog-feed.js.php @@ -0,0 +1,29 @@ + 'object', + 'subtype' => 'blog', + 'distinct' => false, + 'limit' => min(20, (int)get_input('limit', 10)), +]); + +$items = []; +foreach ($posts as $post) { + /* @var ElggBlog $post */ + $link = elgg_view('output/url', [ + 'href' => $post->getURL(), + 'text' => $post->getDisplayName(), + ]); + $time = date("F j, Y", $post->time_created); + $items[] = "