Book Image

WordPress Mobile Applications with PhoneGap

By : Eugene Liang
Book Image

WordPress Mobile Applications with PhoneGap

By: Eugene Liang

Overview of this book

With the explosive popularity of mobile apps and its much anticipated continued growth for the foreseeable future, developers will want to get their hands dirty and build some cool mobile apps. But we know that building mobile apps is not easy: we need to handle cross-platform issues, mobile devices of different screen sizes, not to mention traditional issues such as providing a content management system of the content served in the application. Enter "WordPress Mobile Applications with PhoneGap". We leverage on some of the most popular open source projects: Wordpress, jQuery, jQuery Mobile and PhoneGap and discover how they can be pieced together to build a fully functional cross platform mobile application. "WordPress Mobile Applications with PhoneGap" teaches you how to build mobile application with minimal effort and coding by leveraging on some of the most popular open source projects such as Wordpress, jQuery, jQuery Mobile and PhoneGap. This book looks at some of the most popular open source projects: Wordpress, jQuery, jQuery Mobile and PhoneGap and breaks down the nitty gritty details on how to leverage on these projects to build a fully functional cross-platform mobile application with minimal coding and effort. You will start off by quickly going through the capabilities of Wordpress. Then you will prepare some groundwork on how to make use of plugins and the GeoPlaces theme to provide geographic and API capabilities to WordPress. Next you will learn how to create an external HTML/CSS/JavaScript that consumes and posts data to your Wordpress blog. More importantly, you will see how to convert this external app into a PhoneGap in as little as five minutes. Finally, you will learn how to apply all these techniques and skills to a Wordpress app based on the Twenty-Ten theme and create a cross-platform mobile app using PhoneGap. By the end of "Wordpress Mobile Applications with PhoneGap" you will learn how to piece Wordpress, jQuery, jQuery Mobile and PhoneGap together into a fully functional mobile app.
Table of Contents (13 chapters)

A five minute introduction to WordPress


WordPress is a free and popular open source Content Management System (CMS) that started life as a simple blogging system. It evolved over the years and its look, feel, and capabilities can be easily extended by its themes and plugins.

We will quickly go through the capabilities of WordPress and see how we can leverage on WordPress to build mobile applications of it. The two main capabilities of WordPress that we can leverage on are: themes and plugins.

Themes

Themes in general control the look and feel of any WordPress installation. Going over to http://WordPress.org/extend/themes/, you will see a wide selection of themes that you can download and try for free (most of the time).

For a start, navigate to your WordPress site on your web browser. If you have not made any changes to the site, you should see something like the following on your screen:

Home page of your WordPress installation if you did not make any changes to it

The earlier screenshot is the default theme of WordPress. Now log in to your WordPress site at http://localhost/public_html/wordpress_phonegap/wp-admin and navigate to Appearance. You should see that the Available Themes option provides you with another theme to play with, called Twenty Ten. Click on Activate and navigate to your home page again. You should see the following:

The Twenty Ten theme

The look and feel of your WordPress site is now changed. With a wide variety of themes out there, you can quickly and easily make changes to how your site looks and feels in just a matter of seconds.

Note that we can easily create a mobile website with WordPress by using a mobile theme or themes that support mobile devices. This may be a quick and easy way to create mobile applications out of WordPress, but it does not provide a native interface for the application. Later in this book we will learn about PhoneGap, which is a great way to build native mobile apps using web development techniques. We will be using two themes for this book: one is the GeoPlaces theme that we will be using from Chapter 3, Extending WordPress Using JSON-API, to Chapter 5, Extending WordPress to the Mobile World; the other theme we will be using is the Twenty Ten theme that comes by default with all WordPress installations. We will be covering the Twenty Ten theme in Chapter 6, Using Open Source Themes, of this book.

Plugins

As with all good CMSs, WordPress provides an Application Programming Interface (API) that allows developers to quickly and easily extend the functionalities of a WordPress site. Examples of uses of plugins include adding Facebook's popular "Like" button to each of your posts and extending the administration side of WordPress, such as user management, and adding in search engine optimization capabilities to your WordPress.

While this book is not about developing plugins for WordPress, it's good to understand the power of WordPress plugins. A good example as to how far plugins can take your WordPress site is WordPress's very own BuddyPress (http://codex.buddypress.org) plugin. We will not be making use of BuddyPress in this book, but it's good to see it in action for the purposes of this section:

  1. Log in to your WordPress site and navigate to Plugins | Add New.

  2. Search for BuddyPress.

  3. You can install BuddyPress by clicking on Install Now, and in no time you will have a working social networking site.

This is the power of WordPress plugins. In this book, we will check out an awesome plugin, called JSON API (http://WordPress.org/extend/plugins/json-api/), which can be readily adapted and used for extending our WordPress website.