How to connect to your Wordpress site

Probably the first thing you want to do is to connect the app to your Wordpress site. Here I will show you how to pull up your articles on your iOS and Android app.

Step 1: Clone the app from the repo

Clone the repo into your local disk. You can name it whichever name you like:

$ git clone [app_repo_url] [your_chosen_name]

$ cd [your_chosen_name]

Step 2: Add your blog URL

Let's hook up the app to your Wordpress blog first. For this, open up your favourite code editor (I use Visual Studio Code). Inside your project open up the /src/config/constants.js file and insert your blog url:

// INSERT YOUR BLOG URL HERE
const BLOG_URL = 'https://knowlephant.com';

...

Note: make sure NOT to end your BLOG_URL string with a forward slash, because the app will not be able to reach your website's REST api if you do.

Step 3: Display your desired Suggested articles feed

The app's Home screen contains two feeds. One for Suggested Articles and one for your blog's Latest Articles. The latter will appear automatically once you complete Step 1 above. So let's set up the Suggested article feed as well.

Your app's Suggested Articles feed is created by setting either a Category ID or a Tag ID, both of which can be found on your Wordpress site. Once you decided from which Category or Tag ID you want to create your Suggested Articles feed, add the ID number in the following way inside your /config/constants.js file :

// INSERT YOUR CATEGORY / TAG ID
// NOTE: YOU CAN ONLY ENTER ONE VALUE, THE OTHER VALUE MUST BE null
export const SUGGESTED_CATEGORY_NUMBER = null;
export const SUGGESTED_TAG_NUMBER = null;

Not sure how to find your Category or Tag ID? This post explains exactly where to find each of those.

Last updated