romenov
Member
Posted 8 months ago #
Hello,
I'm trying to get a specific amount of pages using post__in, I've tried it several ways but it always give a blank result. What am I doing wrong?
$bloblor = array(43,45);
$args = array(
'post__in' => $bloblor);
$spotlight = new WP_Query($args); while ($spotlight->have_posts()) : $spotlight->the_post(); $do_not_duplicate = $post->ID; ?>
<?php the_content(); ?>
<?php endwhile; ?>
do this before your normal loop:
$include = array( 37, 1 );
query_posts( array( 'post__in'=>$include ) );
romenov
Member
Posted 8 months ago #
Thanks,
This doesn't work for pages though, is there a way that I can make this work for pages?
Not as far as I know. If needed ths content, I would use a custom query like this:
$spotlight = $wpdb->get_results( "SELECT post_content FROM $wpdb->posts WHERE ID IN( 31,41 )" );
if ( $spotlight ) {
foreach( $spotlight as $spot ) {
print apply_filters( 'the_content', $spot->post_content );
}
}
Note, you will want to keep the query as simple as possible to try to ensure that there are no problems when you upgrade. he query above will pose little problems do to the act that it references on the "post_content" column of the "post" table -> both of which have been a part of WordPress for a long time.
Best of luck,
-Mike