Browse Source

update for APIv2 and 4.4

windhamdavid 9 years ago
parent
commit
1fdafa6b24
2 changed files with 18 additions and 2 deletions
  1. 16 0
      inc/utils.php
  2. 2 2
      underscore.php

+ 16 - 0
inc/utils.php

@@ -1,5 +1,21 @@
 <?php
 
+/**
+ * Filter to Run WP REST API v2 Endpoints and Fix double Slash in rest_url
+ */
+
+add_filter( 'rest_url_prefix', function () { return 'wp-json/wp/v2'; } );
+
+//add_filter( 'rest_url_prefix', 'fix_json_endpoint' );
+//function fix_json_endpoint (){
+//	$json_endpoint = 'wp-json/wp/v2';
+//	return rtrim( $json_endpoint, '/' );
+//}
+
+//remove_filter('json_dispatch_request', 'json_v1_compatible_dispatch', 10);
+//remove_filter('json_endpoints', 'json_v1_compatible_routes', 1000);
+
+
 /**
  * Build path data for current request.
  *

+ 2 - 2
underscore.php

@@ -8,12 +8,12 @@
 						<% print( ( postDate.getMonth() + 1 ) + '/' + postDate.getDate() + '/' + postDate.getFullYear() ); %>
 					</time>
 			</div>
-			<h1 class="entry-title"><a href="<%= post.link %>" rel="bookmark"><%= post.title %></a></h1>
+			<h1 class="entry-title"><a href="<%= post.link %>" rel="bookmark"><%= post.title.rendered %></a></h1>
 			<% if ( 'post' === post.type ) { %>
 
 			<% } %>
 		</header>
-			<%= post.content %>
+			<%= post.content.rendered %>
 		<div class="clear">&nbsp;</div>
 		</div>
 	</article>