• Resolved Majklas

    (@majklas)


    Hi,

    I’ve done custom post type with it’s categories and loading them into a Page Template. My script looks like:

    $args = array(
    	'post_type' => 'portfolio',
    	'paged' => $paged,
    	'portfolio-category' => 'mot',
    	'posts_per_page' => esc_html($portfolio_number)
    );
    $portfolio_query = new WP_Query($args);

    I’ve translated custom post type categories and made dublicates of this post type to another language. If I switch language, I can’t see any custom posts there.
    I know I must change
    'portfolio-category' => icl_object_id(get_cat_ID ("mot"), 'category', false),
    but then I get all posts, not depending on category..

    I must tell, I do have 3 such custom post type categories. Each of them has it’s separate page template loading their custom posts with provided code. Plugin: WPML
    Any help would be appreciated..

Viewing 1 replies (of 1 total)
  • Thread Starter Majklas

    (@majklas)

    Well, I think I found an answer.. Believe me, RTFM helps 🙂 Was looking a bit sideways, but I got it!
    All I needed to do is to add to $args array:

    'tax_query' => array(
    	array(
    		'taxonomy' => 'portfolio-category',
    		'field' => 'id',
    		'terms' => icl_object_id(7, 'portfolio-category'),
    		'include_children' => true,
    		'operator' => 'IN'
    		)
    )

    where terms id is category id in url on default language..

Viewing 1 replies (of 1 total)
  • The topic ‘custom template having custom post type category translations’ is closed to new replies.