So I'm using custom loop and shortcode to insert it in any page. Like this:
function register_custom_shortcode($atts){
extract(shortcode_atts(array(
'ids' => '', // this is what I need
), $atts));
$cutom_loop = new WP_Query( array(
'post_type' => 'cutom_post',
'orderby' => 'menu_order',
'order' => 'ASC'
) );
ob_start();
while ( $cutom_loop->have_posts() ) : $cutom_loop->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(''); ?>>
// post thumb, title and so on
</article>
<?php endwhile;
wp_reset_postdata();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode( 'custom_loop', 'register_custom_shortcode' );
How shoud I handle this ids to have shortcode like this: [custom_loop ids="112,93,34,91"]
?
EDIT:
Ok, if i add 'post__in' => array(189,173)
to new WP_Query it will output only this two posts, but still can't figure out how to grab this ids from shortcode.