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 you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.