所以我有一個所謂的「最新消息」,並使用自定義模板頁面t_latest_news.php添加頁面側邊欄
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="latest-news" id="post-<?php the_ID(); ?>"> <?php the_content(); ?> <?php edit_post_link('Edit this page','<p class="edit-link">','</p>'); ?> </div><!-- /.latest-news --> <?php endwhile; endif; ?>
我創建了一個頁面項目,並把一些內容放到這個頁面。現在,我想在側邊欄上顯示內容。我該怎麼做?
我已經試過類似:
<?php include(get_query_template('t_latest_news.php')); ?> <?php include(TEMPLATEPATH . 't_latest_news.php'); ?> <?php get_query_template('t_latest_news.php') ?> <?php get_template_part('t_latest_news.php'); ?>
但他們沒有工作。幫幫我!
<?php query_posts('page_id=76'); ?> <?php while (have_posts()) { the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php } ?> <?php wp_reset_query(); ?>
它與 「PAGE_ID」,而不是頁面名。任何想法?
我已經把這個,但似乎並沒有工作。 <?php query_posts('pagename = t_latest_news'); ?> – solidcolour 2010-09-20 17:21:19