Where to place code, and which bits to edit
-
alchymyth very kindly posted an example code that I might use to display lots of pages on a single page. The only problem is, I don’t know where to put it, or which bits to edit! I would warmly welcome any suggestions, and wouold like to express my gratitude in advance for your patience with me! The code is:
<?php $args = array( 'post_type' => 'page', 'post__in' => array( 2, 5, 35, 67 ) //list of page_ids ); $page_query = new WP_Query( $args ); if( $page_query->have_posts() ) : echo '<div class="pages-on-page">'; //print any general title or any header here// while( $page_query->have_posts() ) : $page_query->the_post(); echo '<div class="page-on-page" id="page_id-' . $post->ID . '">'; //print any output you want per page// echo '</div>'; endwhile; echo '</div>'; else: //optional text here is no pages found// endif; wp_reset_postdata(); ?>
from this post.
- The topic ‘Where to place code, and which bits to edit’ is closed to new replies.