Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created August 29, 2016 15:51
Show Gist options
  • Save n8finch/e0ed1d252c2be266e79b44e7fe7bb33a to your computer and use it in GitHub Desktop.
Save n8finch/e0ed1d252c2be266e79b44e7fe7bb33a to your computer and use it in GitHub Desktop.
add-new-custom-routes.php
//*Add a controller in the Angular view to work with
add_action('genesis_loop', __NAMESPACE__ . '\do_ng_view_content');
function do_ng_view_content() {
$output = '<div ng-controller="example">'.
'<div class="posts-list" ng-repeat="post in posts">'.
'<div class="single-post">'.
'<h2>{{post.title.rendered}}</h2>'.
'<p>Posted by {{post.author_name}} on {{post.date | date:\'longDate\'}}</p>'.
'<img ng-src="{{post.featured_image_src}}"/>'.
'<a href="{{post.slug}}">Read more...</a>'.
'</div>'.
'</div>'.
'</div>';
echo $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment