Skip to content

Instantly share code, notes, and snippets.

@n8finch
Last active August 29, 2016 15:43
Show Gist options
  • Save n8finch/a60a90e3f092887dadd45c450facf4fa to your computer and use it in GitHub Desktop.
Save n8finch/a60a90e3f092887dadd45c450facf4fa to your computer and use it in GitHub Desktop.
update-the-angular-view.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">'.
'<h2>Recent Posts:</h2>'.
'<div class="posts-list" ng-repeat="post in posts">'.
'<div class="single-post">'.
'<h2>{{post.title.rendered}}</h2>'.
'<p>Posted by Name on {{post.date | date:\'longDate\'}}</p>'.
'<img src="http://placekitten.com/g/200/300"/>'.
'<p ng-bind-html="post.excerpt.rendered | to_trusted"</p>'.
'<p><a href="#">Read more...</a></p>'.
'</div>'.
'</div>'.
'</div>';
echo $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment