1

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?

2 Answers 2

1

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

0
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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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