I'm attempting to order posts by meta data, which is working fine, but the posts without the meta are not shown.
I've tried a couple of guides on Stack Exchange that come up with a quick Google, of which people say they work fine, but adding to my site, the code just does not want to show posts without the meta data.
What I'm trying to achieve is essentially a sticky post, so when a user clicks "Pin Post", a piece of post meta data is stored as "pin_".$user
(so it is unique on this post) with a value of "1"
.
I would like to show posts that have the value "1"
at the top, subsequently ordered by date, after which all other posts without the meta data should be shown, in date order.
I realise this code is incomplete, but here is what I have so far;
query_posts(array('post_type' => array('beauty', 'health', 'food'), 'author_in' => $follow, 'orderby' => 'meta_value_num',
'meta_key' => 'pin_'.$user, 'showposts' => -1, 'order' => 'DESC')); if ( have_posts() ) : while ( have_posts() ) : the_post();
How would I adapt this to produce the desired result?