I'm trying to write a custom search function for my WordPress site. I'm using WP_Query and multiple arraylists.
Is it possible to order by search after taxonomy = pa_felg-bredde
?
Here is my code so far:
$the_query = new WP_Query( $args = array(
'posts_per_page' => 200,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'pa_felg-bredde',
'field' => 'slug',
'terms' => array($f1, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9, $f10)
),
array(
'taxonomy' => 'pa_diameter',
'field' => 'slug',
'terms' => array($ff1, $ff2, $ff3, $ff4, $ff5, $ff6, $ff7, $ff8, $ff9, $ff10)
)
)
));
$query = new WP_Query( $args );
I have now changed from taxonomis to custom field data on my products. Stil cant get the search result to be ordered when output to my website.
Anyone got a clue why that is?
$the_query = new WP_Query( $args = array(
'post_type' => 'product',
'orderby' => 'cf_felgbredde',
'order' => 'DESC',
'relation' => 'AND',
'meta_query' => array(
array(<br>
'key' => ("cf_felgbredde"),
'value' => array($ff1, $ff2, $ff3, $ff4, $ff5, $ff6, $ff7, $ff8, $ff9, $ff10)
// 'compare' => 'LIKE'
),
array(
'key' => ("cf_hoyde"),
'value' => array($f1, $f2, $f3, $f4, $f5, $f6, $f7, $f8, $f9, $f10)
// 'compare' => 'LIKE'
),
array(
'key' => ("cf_dimensjon"),
'value' => array($fff1, $fff2, $fff3, $fff4, $fff5, $fff6, $fff7, $fff8, $fff9, $fff10)
// 'compare' => 'LIKE'
),
)
));