Hi,
I have a custom filed which the site author can enter a manual date (not related to WP’s post date) and have the posts ordered by that custom field. The problem is that if no date is entered for the custom field, those posts do not display at all.
I would like to have a fallback – if no date is entered in the custom field, those posts without the custom field date will be ordered by date created.
I created this query which is displaying only the posts with the custom date:
<?php
$args=array(
'category_name' => 'novedades-eventos',
'posts_per_page' => 50,
'meta_key' => 'newsdate',
'orderby' =>'meta_value_num date',
'order' => 'DESC'
);
$newscat = new WP_Query($args);
if($newscat->have_posts()) : while($newscat->have_posts()) : $newscat->the_post();
?>
Anything that I am doing wrong?
This is the link to the archive page:
http://www.pointer.com.ar/pointer/novedades-eventos/
Thank you,
Dan