OptionTree is a Theme Options UI Builder for WordPress. A simple way to create & save Theme Options and Meta Boxes for free or premium themes. The 2.0 version added support for custom post types and taxonomies along with many other robust features. This article will present a query example for calling custom post types from a certain taxonomy selected by user in the “theme options” panel.

According to the taxonomy parameters, you can call the taxonomy after ID or slug if you specify in array the ‘field’ string. The OptionTree plugin provide the ID of WordPress taxonomies and should not be a problem to use it in a taxonomy query. In my case, I wasn’t able to find a proper way to get posts from a ‘portfolio’ custom post type and ‘project_type’ taxonomy using just the ID’s of categories.
Solution
The following code example show how you can get the custom posts using the ‘slug’ of the taxonomy categories. Change the taxonomy name and OptionTree function ID according to your theme and place it above the loop.
<?php if ( function_exists( 'get_option_tree') ) { $taxonomy = get_option_tree( 'portfolio_sidebar' ); } $term = get_term( $taxonomy, 'project_type' ); $slug = $term->slug; $args = array( 'project_type' => $slug, 'show_count' => 6, ); query_posts($args); ?> |
Are you looking for WordPress themes built with OptionTree theme option panel? Take a look at Panorama WordPress Fullscreen WordPress theme.