Блог
Вывод страниц в цикле, и по отдельным ID
<?php
// WP_Query arguments
$args = array(
//'page_id' => '72',
//
'post__in' => array(
'72',
'57',
'65',
'59',
'70'
),
'post_type' => array( 'page' ),
'post_status' => array( 'publish' ),
);
// The Query
$page_query = new WP_Query( $args );
// The Loop
if ( $page_query->have_posts() ) {
while ( $page_query->have_posts() ) {
$page_query->the_post();
?>
<div class='page-item' id="page-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php the_post_thumbnail()?>
<?php the_content(); ?>
</div>
<?php
}
the_posts_navigation();
} else {
echo "<h2>Записей нет.</h2>";
}
// Restore original Post Data
wp_reset_postdata();
?>
0 комментариев
Старые