How to display upcoming events by dat with Modern Events Calendar Lite

i have found a solution, making a custom SQL query here is the code ( using WPML ) $startday = date(“Y-m-d”); if ( defined( ‘ICL_LANGUAGE_CODE’ ) ) { $lang = ICL_LANGUAGE_CODE; } //echo $startday; global $wpdb,$post; $results = $wpdb->get_results( “SELECT * FROM wp_posts, `wp_mec_dates` AS mecd, wp_icl_translations WHERE wp_posts.ID = mecd.post_id and post_status=”publish” AND wp_icl_translations.language_code=”$lang” … Read more

writing inner join in wpdb

thanks for your time and thanks to @czerspalace I started the query with double quotation and then separate it with a single quotation and after looking at the echo output I found that there’s no spaces between From and table name this is the correct way $pending_reservations = $wpdb->get_results(‘ SELECT booking_calendars.cal_name FROM ‘.$wpdb->prefix.’booking_calendars AS booking_calendars … Read more

Join new table with SQL query

Always escape/prepare your data Don’t leave it open to injections: global $wpdb; $all_posts = $wpdb->get_results( $wpdb->prepare( ” SELECT %s.* FROM %s LEFT JOIN %s ON(%s = %s) WHERE %s=”soundcloud” AND %s=”%s” ” ,$wpdb->posts ,$wpdb->posts ,”{$wpdb->prefix}soundcloud” ,$wpdb->posts.ID ,”{$wpdb->prefix}soundcloud.idpost” ,$wpdb->posts.post_type ,$wpdb->posts.post_name ,$name ), OBJECT ); echo ‘<pre>’.var_export( $all_posts, true ).'</pre>’; Use the prefix $wpdb; offers the $wpdb->prefix, … Read more

Join inside a wpdb query.. confused!

$emailusers = $wpdb->get_results( “SELECT p.ID AS post_id, p.post-title, u.user_email ” . “FROM $wpdb->posts AS p ” . “INNER JOIN $wpdb->users AS u ON p.post_author = u.ID ” . “WHERE p.post_type=”sales” AND HOUR( TIMEDIFF( NOW( ) , p.post_date_gmt ) ) >=1)” ); foreach ($emailusers as $user) { // do wp_mail stuff from here // $emailusers->post_title; // … Read more

Query All users that has post

add this in your arguments ‘query_id’ => ‘authors_with_posts’, $user_args = array( ‘role’ => ‘frontend_vendor’, ‘orderby’ => ‘display_name’, ‘query_id’ => ‘authors_with_posts’, ‘order’ => ‘ASC’, ‘number’ => $no, ‘offset’ => $offset );