Order posts by title and custom field value?

My first attempt to help you with solving your problem would be to do something like this : /* Order Posts Alphabetically */ function prefix_modify_query_order( $query ) { if ( is_main_query() ) { $query->set( ‘meta_query’, array( ‘relation’ => ‘AND’, ‘query_highlight’ => array( ‘key’ => ‘wiloke_listgo_toggle_highlight’, ‘value’ => ‘1’, ‘compare’ => ‘=’ ) ) ); $query->set( … Read more

Woocomerce – Order products by float attribute in archive pages

OK… First of all, `$query->set( ‘orderby’, ‘pa_od’ );’ will most probably do nothing. You can’t order by some string and think that WordPress will guess what that is. Here is the list of possible orderby values: https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters If you want to order by custom field, then you have to do it this way: $query->set( ‘meta_key’, … Read more

WordPress search page pagination displaying but not functional

Answer provided in the comments: global $wp_query; $big = 999999999; // need an unlikely integer $pagination_args = array( ‘base’ => str_replace($big, ‘%#%’, esc_url(get_pagenum_link($big))), ‘format’ => ‘?paged=%#%’, ‘current’ => max( 1, get_query_var(‘paged’) ), ‘mid_size’ => 1, ‘total’ => $wp_query->max_num_pages ); if(have_posts()): while(have_posts()): the_post(); //individual search result endwhile; wp_reset_postdata(); echo paginate_links($pagination_args); endif;

Repeat array inside array through while loop

Start by creating the arguments, but leaving tax_query empty: $args = array( ‘post_type’ => ‘watches’, ‘tax_query’ => array(), ); Then in your loop you can add to tax_querywith $args[‘tax_query’][] =: $args = array( ‘post_type’ => ‘watches’, ‘tax_query’ => array(), ); foreach ( $things as $thing ) { $args[‘tax_query’][] = array( ‘taxonomy’ => $thing[‘taxonomy’], ‘field’ => … Read more

404 page on custom search pagination

So I was using wordpress search and clearly I was passing parameters like this : http://example.com/?s=test&passage=200&kind=none But the problem is I have a taxonomy called passage, exactly like the parameter I was sending to the wordpress search page. My guess is this is a little confusing for wordpress and changing my parameter name to something … Read more