Cookie Authentication In A AngularJS WordPress Theme

Hello beautiful readers! Glad to see you again so soon. Today I’d like to share my findings about cookie authentication and our AngularJS WordPress theme. I’ll show you how exactly to get the cookie authentication working with the theme, and we’ll create a simple AngularJS custom directive to display the user name if she/he is logged in.

What I’ll be showing you in this post I actually spent over two months to figure that out (duh!). Eventually to my surprise that cookie authentication is quite simple when we are just building WordPress themes or plugins. Read More…

Upgrading Your AngularJS Theme To Work With WP API V2

Today in this post, I’ll be showing you how to upgrade the AngularJS WordPress theme that we have been working on for a very long time, to work with the latest WP API v2 (beta 4 at the time of this writing).

To be honest I didn’t expect the WP API v2 would be so much different from the version 1. When I talked about upgrading the theme in some comments of my tutorials, I thought it just about updating the routes and that’s all. It turned out I was wrong and the mistakes I’ve made are pretty worthy of documenting. So here we go. Read More…

Getting Posts By Taxonomy Or Meta Field With WP-API v2.0

In the post adding fields to the JSON response of the WP REST API, you’ve learned about how to manipulate the data from the WP REST API (WP-API). Another topic I got asked very often, is how to get posts by certain filters – mostly taxonomy and meta field. So today let’s talk about it.

Before we get started, if you’re looking for the workarounds for WP-API v1.x, Josh has written great tutorials for you. Here are the links of them:

  1. Working with Taxonomies Using the JSON REST API
  2. Working with Meta Data Using the JSON REST API

In the following article, I’ll show you the quick answers and a more bigger picture beyond them. If you’re not interested in the later one, feel free to skip it. Read More…

So Here Comes The Higgs

Today I changed the theme here from Ryu to Higgs by Codestag. This is the first time I bought a premium theme from Envato. I choose very carefully that I’ve followed the works by Codestag for a while. And somehow they conviced me.

Now with Higgs I only changed the color and widgets then left everything else by default. It looks almost as I expected. Just it requires the Jetpack to display the site logo, which is the plugin I’m allergic to, so I would rather to give up the beautiful logo for a while… until next time I change the theme again.

As most beautiful themes, Higgs also requires a hero image for each post, it’s optional but without it, the first post would be sticky to the header area. I’m a little uncomfortable with it but it’s Friday so I’ll leave it that way.

I hope everything gets well and you can still enjoy the reading here. If not, just shoot me an email: yoren [at] I’ll see what I can do for you.


Updated July, 20: I just found the style of Gists is broken in Chrome. For example the gist below:

The indentation behaves well in Firefox and Safari, but acts weird in Chrome. Any idea?

Updated July, 20, part-2: I can’t believe it’s the text-rendering broke the theme! After this modification, things go well again!

body {
	text-rendering: auto;
	-webkit-font-smoothing: auto;

Adding Fields To The JSON Response Of The WP REST API

The WP-API team got the documentation updated, so be sure to check this post out before you modifying the JSON response. (Thanks PDuran for this.)

Since I started the series about building themes with AngularJS and WP REST API, I got asked lots of questions that sometimes they were involved more with AngularJS, and sometimes they were more concerned with WP REST API.

To be honest, I prefer WP REST API related questions because they usually take less time for me to solve. After all, I’m quite new to AngularJS so before answering each question I’ll do some research to make sure my answer will be backed up.

Most questions related to WP REST API can be solved by manipulating data in the JSON response. Yes, though the post title might imply the “adding” part, we can also “update” or “remove” fields (data) with the same approach. Let’s get started. Read More…

Tidy Up Your AngularJS WordPress Theme With A Service

In the previous post, I spent some time to walk you through the basics about services in AngularJS, including what is a service, how to create a factory service, and what exactly can be improved with the new WPService created by us.

So basically it’s mainly about how to share data between controllers with a service (which looks so magical especially when we change the routes). If you’re convinced by the example I just demoed, I’m glad to show you another important usage about services, which we’ve mentioned that they are designed to organize and share code across the AngularJS app. That’s why I’m saying we can tidy up our AngularJS WordPress theme with a service.

Let’s start by taking a look at the controllers in scripts.js – the Main and Paged controller, to see if there’s anything can be rewritten to be reusable, and move the reusable code into our WPService service. Read More…