Custom permalinks – post type – hierarchical taxonomy’s

Thanks for referencing my solution. You forgot one part though – defining the rewrite of your cpt. From my solution: First get your slugs right when defining your custom post types and taxonomies: for the custom post type it should be basename/%taxonomy_name% and the slug for your taxonomy should be just basename. Dont forget to … Read more

Filter all queries with a specific taxonomy

Below code is an example that does what you want. See tax_query for more information. function my_get_posts( $query ) { // we only need to modify the query for logged in users if ( !is_user_logged_in() ) return $query; $current_user = wp_get_current_user(); // assuming that user’s region is stored as user_region meta key $user_region = get_user_meta( … Read more

Custom search for custom post type, custom meta and search fields

If you want to extend your query, you should extend it through the pre_get_posts-filter. Then just do a “Custom Field” or meta query. add_action( ‘pre_get_posts’, ‘wpse105969_extended_search’ ); function wpse105969_extended_search( $query ) { // Make sure we got a search query // and we’re only modifying the main query. if ( ! $query->is_main_query() AND ” === … Read more

Order posts by (hierarchical custom) taxonomy terms and term children

This query will handle two levels of hierarchy in your taxonomy. More than two levels of hierarchy and you’ll need a recursive self-join. What this does is return the posts in the correct child within parent order. To create the appropriate parent level headings, you’ll have compare the current post’s parent taxon with that of … Read more

How can I display parent and child taxonomies in separate drop downs?

Hello Everyone out there, who are facing difficulty to display the parent and child taxonomies in drop down, i found the solution for the above problem…… edit the code in the functions.php file, before the code was $categories= get_categories(‘child_of=”.$_POST[“main_catid’].’hide_empty=0′); now edit the code, like this… $categories= get_categories(‘child_of=”.$_POST[“main_catid’].’&hide_empty=0′.’&taxonomy=state’); and this works so beautifully, try it for … Read more