0

hi i want to display posts by term. first the code display all the posts:

 $aProjectArgs = array(
            'post_type' => 'uni_project',
            'posts_per_page' => -1,
            'orderby' => 'menu_order',
            'order' => 'asc'
);

so i add another part of code to display posts by term:

$aProjectArgs = array(
            'post_type' => 'uni_project',
            'posts_per_page' => -1,
            'orderby' => 'menu_order',
            'order' => 'asc'
            'tax_query' => array(
    array(
    'taxonomy' => 'post_tag',
    'field' => 'id',
    'terms' => 43
     )
  )
        );

but its not working its give me an error message:Parse error: syntax error, unexpected ''tax_query''

can someone help me?

0

put , in 'order' => 'asc' 'tax_query'

0

Replace your code with this one.

 $aProjectArgs = array(
                'post_type' => 'uni_project',
                'posts_per_page' => -1,
                'orderby' => 'menu_order',
                'order' => 'asc',
                'tax_query' => array(
        array(
        'taxonomy' => 'post_tag',
        'field' => 'id',
        'terms' => 43
         )
      )
            );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.