WordPress search form and search result through ACF field in custom taxonomy

This should hopefully help you on your way, although I’ve not fully tested it… The basic search form here which will load the site_url() with appended search query string. You should change this to better reflect your site layout such as <?php site_url( ‘search’ ); ?> (‘http://website.com/search‘). Place the Results page code within the results … Read more

Pagination not working on my archive page for a custom post type

So I got this to work by adding this function to functions.php // Custom query for events function set_posts_per_page_for_events_cpt( $query ) { if ( !is_admin() && $query->is_main_query() && is_post_type_archive( ‘events’ ) ) { // set date $currentdate = date(“Y-m-d”,mktime(0,0,0,date(“m”),date(“d”),date(“Y”))); $meta_query = array( array( ‘key’=>’event_date’, ‘compare’ => ‘>=’, ‘value’=> $currentdate, ‘type’ => ‘DATE’, ), ); $query->set(‘meta_query’, … Read more

What is the best way to reset a search on a meta_key / meta_value?

I wouldn’t push the meta query entries like that but build it more logical. So for example: $meta_query_args = array( ‘relation’ => ‘AND’ ); // assuming you want ‘AND’ search, you’re using both in your example if ( ! empty( $_POST[‘city’] ) && $_POST[‘city’] != ‘0’ ) { $meta_value_ville = $_POST[‘city’]; $meta_query_args[‘city_clause’] = array( ‘key’ … Read more

Query custom meta value – post view and date meta

@Sadia Please, try this once:: $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘3’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘post_view’,// say 200 ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DSC’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘post_view_last’,//2017-04-14 ‘value’ => date(‘Y-m-d’, strtotime(‘-7 days’)), //value of “order-date” custom field ‘compare’ => ‘>=’, //show post less than … Read more

wp_query sorting – one specific meta_key value at last and then sort by create date

If you’re using WordPress 4.2 or newer then you can do the following: $args = array( ‘post_type’ => ‘products’, ‘posts_per_page’ => 10, ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘tools_clause’ => array( ‘key’ => ‘tools’, ‘compare’ => ‘EXISTS’, ), ‘create_date_clause’ => array( ‘key’ => ‘create_date’, ‘compare’ => ‘EXISTS’, ), ), ‘order_by’ => array( ‘create_date_clause’ => ‘ASC’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)