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

Here’s how to customize a Post List component (slug my-component-slug) query so that the posts can be sorted by alphabetical order instead of default chronological order:

//To put in the "php" folder of your WP-AppKit theme:
function my_custom_query( $query_args, $component ) {
	
	if( $component->slug === 'my-component-slug' ) {
		$query_args['orderby'] = 'name';
		$query_args['order'] = 'ASC';
		//see https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
	}
	
	return $query_args;
}
add_filter( 'wpak_posts_list_query_args', 'my_custom_query', 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

Or

Contact Us