Formatting a date/time returned from a custom $wpdb query

A much simpler method to bypass these issues is using WP_Query: $popularQuery = array(‘orderby’ => ‘comment_count’, ‘posts_per_page’ => ‘-1’, ‘author’ => 1); $popularPosts = new WP_Query($popularQuery); while($popularPosts->have_posts()) : $popularPosts->the_post(); ?> <tr> <td><a href=”https://wordpress.stackexchange.com/questions/23820/<?php the_permalink(); ?>”><?php the_title(); ?></a></td> <td><?php the_author(); ?></td> <td><?php the_time(‘j M Y h:i A’) ?></td> <td><?php comments_number(); ?></td> </tr> <?php endwhile; Also note … Read more

Order by custom date field

I found the following solution: SELECT wposts . * FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = ‘datum’ AND wposts.post_type=”optredens” AND wposts.post_status=”publish” ORDER BY wpostmeta.meta_value ASC As other query_posts() methods / alternatives did not work very well.

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