Loop posts in a table ordered by a custom field value

I found a solution which displays the posts ordered by the date value, and also removes the past ones. <div class=”container”> <div class=”row”> <table> <tr> <th>Artista</th> <th>Fecha</th> <th>Ciudad</th> <th>Información</th> </tr> <?php $today = current_time(‘Ymd’); $args = array( ‘post_type’ => ‘evento’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => ‘-1’, ‘meta_query’ => array( array( ‘key’ => ‘fecha_del_evento’, ‘compare’ => … Read more

Display ‘modified date’ in WordPress Twenty Fourteen

Look for the code that displays the post date. It should look something like the following: Posted on: <?php the_time(‘l, F jS, Y’) ?> Now replace it with the following code (slightly modified from Ardamis’ post): Posted on <?php the_time(‘F jS, Y’) ?> <?php $u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_modified_time != $u_time) { … Read more

Query post for today, if no post get the previous one

I think you should make a recursion function that will call itself if there’s no posts found passing new date to query for.. function getDatePosts( $date, $query_args ) { $query_args[‘date_query’] = array( ‘year’ => date( ‘Y’, $date ), ‘mounth’ => date( ‘m’, $date ), ‘day’ => date( ‘d’, $date ) ); $query = new WP_Query( … Read more

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