Category Archives: Ionic wordpress
Ionic wordpress Access-Control-Allow-Origin json ApI error (CORS)
Posted by:Ryan zongo, May - 07 - 2016
What to do when your ionic cannot pull data from your wordpress with JSON ApI ?
This plugin provides a JSON format for the content that is in the wordpress. But
- You will need to go to wp-content/themes/myTheme
- open functions.php
- Add this header(“Access-Control-Allow-Origin: *”); right after <?php
<?php
header(“Access-Control-Allow-Origin: *”);
II. solution 2
Some advice to modify directly the pluggin
You just have to add:
<? header("Access-Control-Allow-Origin: *"); ?>
On the file api.php, this file is located in wp-content/plugins/json-api/singletons/api.php
Your choice.
How to solve cordova plugin whitelist.
Posted by:Ryan zongo,
You are almost there. But you get another error :
You must install the whitelist plugin but you dont know how to configure this plugin to work with cordova-android
In this case no worries. This step works fine
- run this ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git
- in xml config::: Add this <allow-navigation href=”*” />
- in your index.html add <meta http-equiv=”Content-Security-Policy” content=”default-src *; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval'”>
Create Ionic App from A to Z with WordPress
Posted by:Ryan zongo,
Here are the step to make your app runing in 5 minute
Ionic is cool for everyone. If you need help after this steps do not hesitate to drop me a line. I am here to help. We offer end to end user experience and service for all our clients.
Again, these are steps and i will show you the app that came up after this steps.
- Ionic start myAppName
- ionic platform rm android
- ionic resources –icon
- ionic resources –splash
- ionic platform add android
- Ionic plugin add cordova-plugin-admobpro
- cordova plugin add cordova-plugin-whitelist
- ionic build android
- adb devices
- adb install -r platforms/android/build/outputs/apk/android-debug.apk
debug:
ionic run android -l -c
This last command will launch the app in debug mode
If you want to inspect the app from Chrome, just type or copy paste in the browser the followin line
chrome://inspect/#devices
The two commands are not necessary
- ionic resources –icon
- ionic resources –splash
However it will help you generate the icon and splash. Here is the result icons i made