Skip to content

Latest commit

 

History

History
88 lines (62 loc) · 3.68 KB

readme.md

File metadata and controls

88 lines (62 loc) · 3.68 KB

frontpress-logo-horizontal

A full front-end AngularJS template for WordPress Rest API.

Build Status Codacy Badge Join the chat at https://gitter.im/teles/frontpress Github Issues dependencies Status devDependencies Status

https://nodei.co/npm/frontpress.png?downloads=true&downloadRank=true&stars=true

Getting Started

Install FrontPress using NPM:

npm install frontpress --save
  • Import angular and frontpress to your project.
<script type="text/javascript" src="/node_modules/angular/angular.min.js"></script>
<script type="text/javascript" src="/node_modules/frontpress/release/frontpress.min.js"></script>

Install FrontPress using Bower:

bower install frontpress --save
  • Import angular and frontpress to your project.

⚠️ remember to install angular 1.x.

<script type="text/javascript" src="/bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="/bower_components/frontpress/release/frontpress.min.js"></script>

Configure your project to use FrontPress

  • Add frontpress to your required modules list:
angular.module('myBlog', ['frontpress']);
  • Configure your module using $FrontPressProvider !
angular.module('myBlog').config(function($FrontPressProvider){

	$FrontPressProvider.configure.load({
		"restApiUrl": "https://demo.wp-api.org/wp-json",
		"apiVersion": "v2",
		"pageSize": 5,
		"infiniteScroll": true,
		"routes": {
			"post": "/:postYear/:postMonth/:postDay/:postSlug",
			"home.pagination": "/page/:pageNumber"
		},
		"titles": {
			"post": ":postTitle - :siteName",
			"home": "Home - :siteName"
		},
		"overrides": {
			"siteName": "My Awesome SPA Blog"
		}
	});
	
});

It's done!

Further relevant informations

License

MIT © Teles