Form for search pages by meta datas

Take a look at https://developer.wordpress.org/reference/classes/wpdb/get_col/ On your result page, receive the query as follows <?php if(isset($_POST[‘name’]) || isset($_POST[’email’])){ $name=”%” . $wpdb->esc_like( $_POST[‘name’] ) . ‘%’; $email=”%” . $wpdb->esc_like( $_POST[’email’] ) . ‘%’; global $wpdb; $prepare = $wpdb->get_col( $wpdb->prepare( ” SELECT post_id FROM “.$wpdb->prefix.”postmeta AS M WHERE M.meta_value LIKE ‘%s’ OR M.meta_value LIKE ‘%s’ “, $name, … Read more

Custom query to retrieve oldest post and retrieve others with date interval

I’ve quickly tested the below code with a small subset of sendouts ( 3 ) and changing the publishing date of my page that uses this template it works fine <?php /** * Template Name: show sendouts template * */ get_header(); global $wpdb, $post; $curDate=strtotime(date(‘Y-m-d H:i:s’)); $postDate=strtotime($post->post_date); $pageAge=($curDate-$postDate) / (60 * 60 * 24); // … Read more

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