lib/wp/api/endpoints.rb in wp-api-0.1.5 vs lib/wp/api/endpoints.rb in wp-api-0.1.6
- old
+ new
@@ -27,9 +27,17 @@
def page_named(slug)
resource_named('pages', slug)
end
+ def item_named(slug)
+ begin
+ item = resource_named('posts', slug)
+ rescue WP::API::ResourceNotFoundError
+ item = resource_named('pages', slug)
+ end
+ end
+
private
def resources(res, query = {})
resources, headers = get(res, query)
resources.collect do |hash|