Get Terms By Custom Post Types And Taxonomy In WordPress

The following snippet saved me a bunch time when dealing with a recent project. The scenario was I created 2 custom post types and they share the default “category” taxonomy with Posts. On the post type archive page, I have to display the category links so users can filter the posts. The difficult part was I wanted …

Read moreGet Terms By Custom Post Types And Taxonomy In WordPress

Changing Arguments For The Built-In Taxonomies In WordPress

With the following snippet you can change arguments for the built-in taxonomies in WordPress: View the code on Gist. To modify arguments for the built-in taxonomies might not be a good idea unless you really know what you’re doing. I’m doing this because (not sure since when) now WordPress won’t let me display links from the …

Read moreChanging Arguments For The Built-In Taxonomies In WordPress

Getting Categories With Posts In A Single WP API Request

UPDATED March 03, 2016:

Post has been updated. Now we use "rest_prepare_category" filter for this job.

UPDATED March 02, 2016: 

With the latest WP API V2 Beta12, the filter "rest_prepare_term" I used in this post no longer work and it should be changed to "rest_prepare_category". I'll update the post content ASAP.

A while back ago I wrote a post to show you how to “Adding Fields To The JSON Response Of The WP REST API“. In the first scenario why we’ll ever need to add fields to WP API, is for people who want to build an accordion menu with categories as the first level links, which when being clicked, the posts would be collapsed as the second level links.

We know we could use WP API to get a single category info, and we can also get the posts for a certain category, but unfortunately we can’t do both in a single API request.

Read moreGetting Categories With Posts In A Single WP API Request

Setting Page Title Dynamically In AngularJS WordPress Theme

Changing the page title dynamically is an important feature in our AngularJS WordPress Theme. If you have checked some articles related to this topic, you might find it’s a bit hard to integrate those methods to our theme. There are two reasons: We just moved the ng-app=”app” from html to #page div, that means the …

Read moreSetting Page Title Dynamically In AngularJS WordPress Theme