As explained here Post List components queries can be customized using the wpak_posts_list_query_args filter hook.

Here’s how to define a component (slug my-component-slug) that gets posts from 2 categories (my-first-category-slug and my-second-category-slug) instead of only one.

Create a post list component in your app, associated to one category. Then use the tax_query parameter of WP_Query to customize the component’s categories and add a second category it:

//To put in the "php" folder of your WP-AppKit theme:
function two_categories_for_my_component( $query_args, $component ) {
	if( $component->slug === 'my-component-slug' ) {
		$query_args['tax_query'] = array(
				'taxonomy' => 'category',
				'field' => 'slug',
				'terms' => 'my-first-category-slug'
				'taxonomy' => 'category',
				'field' => 'slug',
				'terms' => 'my-second-category-slug'
	return $query_args;
add_filter( 'wpak_posts_list_query_args', 'two_categories_for_my_component', 10, 2 );

Published by Mathieu on June 23, 2017

Freelance Senior Web Developer, WordPress since 2009, JS/Backbone since 2012, Custom Back-End devs, WebApps and Plugins for clients and the community.

Leave a Reply

Your email address will not be published. Required fields are marked *

Having questions?

FAQ | Tutorials | Documentation


Contact Us