Skip to content

Cordova mobile application to read wordpress blog and generate a cross platform mobile app

License

Notifications You must be signed in to change notification settings

enoliglesias/wpreader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP Reader

⚠️ Since the rest-api is now an include, not a plugin, and the specification had change, this repository is DEPRECATED. Do not use it to create your mobile app. I'm working in a react-native version with the new WP API. I'll link it here when it's finished. ⚠️

Cordova project to read wordpress blog and generate a cross platform mobile app.

As you can see, the names and references, it's always about recipes. It's because we use this repo to build the mobile app for the blog Begin Vegan Begun™

Installation

  • Install Cordova, dependencies, etc. (Don't worry! It's "fun")
  • Cordova plugins needed:
    • cordova-plugin-dialogs 1.2.0 "Notification"
    • cordova-plugin-whitelist 1.2.0 "Whitelist"
    • org.apache.cordova.device 0.3.0 "Device"
  • Install the Wordpress API plugin in your blog. WP Rest API.
  • Add CORS headers to API. Go to file rest-api/core/wp-includes/rest-api/rest-functions.php and set:
     header( 'Access-Control-Allow-Headers: accept, access-control-allow-headers, access-control-allow-origin' );
     
     header( 'Access-Control-Allow-Origin: *' );
  • Allow query post by date in the API. We need this info in the app. Go to file rest-api/core/wp-includes/functions.php and add:
     function my_rest_query_vars( $valid_vars ) {
        $valid_vars = array_merge( $valid_vars, array( 'date_query' ) );
        return $valid_vars;
     }
     add_filter( 'rest_query_vars', 'my_rest_query_vars' );
  • Add tags and categories to post controller in order to get it in the JSON response. Go to file rest-api/core/wp-includes/rest-api/class-wp-rest-posts-controller.php, then go to function prepare_item_for_response and add to the array the following entries:
		'tags'			 	 => wp_get_post_tags($post->ID),
		'categories'	 => wp_get_object_terms($post->ID, 'category'),
  • Configure settings.js
  • Be careful and remember to change each reference to Begin Vegan Begun™ to your blog's name. Begin Vegan Begun™ is a trade mark.
  • Add the platforms you want by cordova platform add [platform] and configure them as you wish.
  • Run cordova build [platform]
  • Have fun!

Screenshots

You can take a look at the application that I made with this proyect. It's published in the Play Store and iTunes (soon).


Get it on Google Play

Get it on App Store

TODO

  • Push notifications

    I'm working in a parallel project (Pushificator) to send push notifications to a mobiles from a web app. Once I get this project finished I'm going to add in this project functionality to register the devices in that web app, vía API. And then send the notifications :)

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

Enol Iglesias Lorenzo (undefinedmethod.com)

License

WP Reader is released under the MIT License.

Begin Vegan Begun™ is a trade mark.

About

Cordova mobile application to read wordpress blog and generate a cross platform mobile app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published