Query events post type after current date and timezone

date() PHP functions returns the value of time() PHP functions in the specified format. time() use server local time. If you want to get date/time based of WordPress configuration, you could use current_time(), a WordPress function, instead of native PHP functions. // ‘timestamp’ = Unix Timestamp or ‘U’ PHP time format $current_time = current_time( ‘timestamp’ … Read more

Querying, storing, and using data from 2 separate custom post types

For custom field queries you can’t use an array for multiple keys, unfortunately. What you want is something like this: $args = array( ‘post_type’ => array(‘gym_location’, ‘gym_term’), ‘orderby’ => ‘title’, ‘order’ => ‘DESC’, ‘meta_query’ => array( array( ‘key’ => ‘term_active’, ‘value’ => ‘1’, ‘compare’ => ‘==’ ), array( ‘key’ => ‘location_active’, ‘value’ => ‘1’, ‘compare’ … Read more

WP_Query – show posts where meta value and user_email match

Both examples of your code throw errors on the while line: <?php while ( $users_query->have_posts(): $users_query->the_post() ) ?> The while will work if you move the parenthesis from the end to before the colon, and replace the parenthesis with a semicolon. <?php while ( $users_query->have_posts() ) : $users_query->the_post() ; ?> (The Errors turn up fast … Read more

How to show one post content in another post content which has same terms?

I have solved the problem myself: What I did is: First created single-football_league.php template where i placed following codes: <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( ‘content-parts/content’, ‘league’ ); ?> <?php endwhile; ?> Second: In content-league.php, I placed following codes, and it works: $terms = wp_get_post_terms( $post->ID, array(‘competition’, ‘session’) ); $term_slugs = … Read more

WP User Query with meta queries

Actually, I think your code says Where min_price >= $price and max_price <= $price. Try to switch the operands, like here: array( ‘key’ => ‘min_price’, ‘value’ => $price, ‘compare’ => ‘<=’, ‘type’ => ‘NUMERIC’ ), array( ‘key’ => ‘max_price’, ‘value’ => $price, ‘compare’ => ‘>=’, ‘type’ => ‘NUMERIC’ ), It works for 10.000 and 20.000 … Read more

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