ikarus7
Forum Replies Created
-
Looks like I found a workaround for this. Seems like
the_archive_title()function isn’t triggering the qTranslate filter, so rather than calling this function, we can manually apply the filter instead using__( ... )as described in the qTranslate start up guide.So taking this scenario, I use
get_the_archive_title()instead:
<?php echo __( get_the_archive_title() ); ?>This will now output only the right translation, however, do make sure that the custom post type category’s labels are declared for each language too. i.e. [:en]Category[:aa]title1[:bb]title2[:]. Otherwise, the “Category: (term)” output on
get_the_archive_title()will only output whatever language it is declared for.- This reply was modified 9 years, 4 months ago by ikarus7.
Thanks ChaseWiseman, that works well!
What I’ve done is slotted this query inside the foreach( $types as $type ) loop:
$query_args = array( 'orderby' => 'title', 'order' => 'ASC', 'post_type' => 'products', 'posts_per_page' => 4, 'tax_query' => array( // query the product_type using the current type's slug and only fetch parent items array( 'taxonomy' => 'product_type', 'field' => 'slug', 'terms' => $type->slug, 'include_children' => false ) )); $type_query = new WP_Query( $query_args );That fetches my required posts and I can then extract data from each post from there. This does exactly what I need it to do. Thanks again!