Static Generator / Renderer • Create a fast and resilient user-facing site. • Utilize front-end atomic design tools, minimal/ elegant markup, etc. • Read-only, but highly secure and scalabe.
Hybrid • Build up a REST API on your site to power dynamic forms/ dashboards. • Many other functions served directly from WordPress as per normal. • Restrains the scope. Allows for particular experiences to be enhanced.
“Single Page” App • Client side JavaScript application runs in- browser, pulls data from WordPress via API. • May include user interactions, or be purely content oriented. • Typically utilize a front- end framework like Angular, Backbone, or React.
Native Mobile App / IoT • WordPress powers embedded applications via API. • May also present some web functionality to users. • Drive IOS and Android native apps, as well as “internet of things” implementations.
WordPress-on-WordPress • Separation of concerns, but not technologies. • Front-end WordPress can control configuration, caching, throttling. • Develop reusable components for a Service-Oriented / Microservices architecture.
● WordPress CMS with Artwork custom post type ● A simple web page to consume data and display it two different ways: ● A list of teasers ● A map. Playing with Data
● In functions.php: create a type called Artwork ● Include in arguments when setting up Custom Post Type: ○show_in_rest ○rest_base ○rest_controller_class Custom Post Types
● ACF to WP-API (adds ACF data to ouput) ○ https://wordpress.org/plugins/acf-to-wp-api/ ● Better REST API Featured Images (adds Featured Image data to output) ○ https://wordpress.org/plugins/better-rest-api-featured- images/ Helper Plugins
● Grab JSON data (from the artwork endpoint) ● Create unordered list of Artwork: thumbnail, artwork name, artist, description ● Create map of Artwork: latitude/longitude fed to LeafletJS Recipe
$.ajax( { url: 'http://wordcampus2015.local/wp-json/wp/v2/artwork', success: function ( data ) { posts = data; for (var i = 0; i < posts.length; i++) { var post = posts[i]; // CREATE LIST ITEMS } }, cache: false } );
var lat = post.acf.latitude; var long = post.acf.longitude; var marker = L.marker([lat, long]).addTo(map); marker.bindPopup('' + post.title.rendered + '' + post.acf.artist + '');