Masonry layout within the loop

try this. i am not sure it would work for masonary layout or not. but it would give you an idea on how to make rows and columns within loop. if ($news->have_posts() ) : while ($news->have_posts() ) : $news->the_post(); //$value = $news->current_post; if($value % 3 == 0){ ?> <div class=”row”> echo “<div class=”col-lg-4″>”; <div class=”height … Read more

Sorting posts by meta values: 2 different orders

I think it should be able to hook into the posts_clauses filter to add a field to your sql query. add_filter( ‘posts_clauses’, ‘intercept_query_clauses’, 20, 1 ); function intercept_query_clauses( $pieces ){ global $wpdb; $pieces[‘fields’].=’, (IF(UNIX_TIMESTAMP()>=’.$wpdb->postmeta.’.meta_value,’.$wpdb->postmeta.’.meta_value,(UNIX-TIMESTAMP() – ‘.$wpdb->postmeta.’.meta_value)+UNIX_TIMESTAMP(‘2099-01-01′))) as timestamp_direction’; $pieces[‘orderby’]=’timestamp_direction ASC’; return $pieces; } The logic is as follows: Let’s say you have some timestamps in … Read more