Вопрос

I have an array of IDs that i send to query_posts to get the posts (which works fine) but it seems to always put the attachment(562) last even though it is the newest. Also tried title and ASC vs DESC but its always last?

$slide_args = array( 
    'post_type'   => 'attachment', 
    'post_status' => 'inherit',
    'fields'      => 'ids',
    'tax_query' => array(
        array(
            'taxonomy' => 'media_tag',
            'terms'    => 'new-work',
            'field'    => 'slug',
        )
    )
);

$slide_attachments = new WP_Query($slide_args);

$sticky_ids = get_option('sticky_posts');

$slideshow_posts = array_merge($slide_attachments->posts,$sticky_ids) ;

// creates Array ( [0] => 562 [1] => 479 [2] => 598 [3] => 686 ) 
// 562 is an attachment, the others are posts

$postsargs = array(             
    'orderby'       => 'date',
    'order'         => 'DESC',  
    'post_status'   => 'published',
    'post_type'     => array( 'attachment', 'post' ),
    'post__in'      => $slideshow_posts,
);

query_posts( $postsargs );

anyone know what might be going on? Best, Dc.

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с wordpress.stackexchange
scroll top