function show_page($post_id = 0, $post_level = 0) { // 取得層數方便下標題 echo '<article class="article-content"><h' . ($post_level + 2) . ' class="article-title"><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h' . ($post_level + 2) . '><div class="thumbnail-img">'; the_post_thumbnail('large'); echo '</div>'; the_content(); if (is_page()) { //取得子網頁 $args = array( 'post_status' => 'publish', 'post_type' => 'page', 'post_parent' => $post_id, 'orderby' => 'menu_order', 'order' => 'ASC', 'nopaging' => true, ); tcc_attachments($post_id); $pages = get_posts($args); foreach ($pages as $post) { setup_postdata($post); show_page($post->ID, $post_level + 1); } } echo '<div class="clearfix"></div></article>'; }
<!-- single --> <?get_header();?> <div id="content" class="content"> <div class="article"> <?while (have_posts()) : the_post();?> <article class="article-content"> <h1 class="article-title"><?the_title();?></h1> <div class="article-meta"> <ol class="breadcrumb"> <li><?the_time(__('Y/n/j','tcc'));?></li> <li><?the_category(' , ');?></li> <li><?the_tags('', ' , ', '');?></li> </ol> </div> <?the_content();?> <?tcc_attachments($post->ID);?> <div class="clearfix"><?_e('Expiration date:', 'tcc');echo date_format(date_create(get_post_meta($post->ID, '_expiration', true)), 'm/d/Y H:i:s');?></div> </article> <div id="comments"><!-- 暫不提供留言功能 --></div> <?endwhile;?> </div> </div> <?get_footer();?>